枚举每一个位置时,我们要计算出当前位置之前的位置字符都相同,这一位置正好不同的方案数 很好判断,如果当前的i=pi,那直接跳过就行了,因为这一位不可能不同 我们操作完了之后,把i和pi用并查集连起来,代表其要取一样的值 同时我们也知道了,如果find(i)=find(pi),那也可以跳过了 具体处理推推柿子就出来了,不...
来自arc的151C。 C - 01 Game 博弈 原题链接:C - 01 Game 题意: 给定一个1*n的空棋盘,棋盘中已经存放着一些黑棋和白棋。Alice和Bob开始博弈,每人可以每轮下一个棋,要保证棋盘中不存在两个相邻的棋子颜色相同,不能下的人输,请问两人在最优的前提下谁能获得胜利。 分析: 这是一个公平游戏,两人的博弈...
We will hold AtCoder Regular Contest 151. Contest URL:https://atcoder.jp/contests/arc151 Start Time:http://www.timeanddate.com/worldclock/fixedtime.html?iso=20221016T2100&p1=248 Duration: 120 minutes Number of Tasks: 6 Writer:leaf1415 ...
#include<vector>#include<iostream>#include<algorithm>usingi64 =longlong;usingvint = std::vector<int>;usingPII = std::pair<int,int>;intmain(void){//Think twice, code once.std::ios::sync_with_stdio(false); i64 a[3]; std::cin >> a[0] >> a[1] >> a[2]; i64 x = a[0] ...
AtCoder Regular Contest 一句话题解 因为上篇AGC的写的有点长……估计这篇也短不了所以放个一句话题解方便查阅啥的吧QwQ 具体的题意代码题解还是往下翻…… ARC 058 D:简单容斥计数。 E:用二进制表示放的数字,然后状压$DP$。 F:$biset$优化$DP$预处理,乱搞贪心。
如题,ARC150 A题 C题 的解题报告。 A - Continuous 1 题意: 有1, 0, ? 组成的一个序列(?可以为0/1), 问恰好有且仅有k个i, 且连续的情况有多少种。 分析: 考虑O(n). 常见为转化成求以每个 i 结尾的信息。 即求长度为k的序列满足以下条件的有且仅有一个: 没有零;(有连续k个1) 前后没有...
164 -- 1:43:11 App [6/8] AtCoder Beginner Contest 286 (unrated) 181 -- 27:25 App [6/6] VP AtCoder Beginner Contest 166 (随机 VP) 441 1 2:00:59 App [5/7] Educational Codeforces Round 142 (1660 ⭜ 1889) 468 -- 42:43 App AtCoder Beginner Contest 334 A 至 G 題...
AtCoder Regular Contest 090 C - Candies 链接:https://arc090.contest.atcoder.jp/tasks/arc090_a 题意:求矩形左上角到右下角的最大元素和(走动路径只能是向右或者向下) 分析:dfs,也可以是dp 【dfs】代码: #include <bits/stdc++.h> using namespace std;...
前面四道题都比较简单,后面两道题的题面到现在都没有加载出来。 A - Bridge and Sheets 直接计算就好了。具体而言,使用一个变量记录前面一个木板右端点是哪里,然后在看当前木板的时候,如果中间有空隙就加上,然后接着维护下去就行了。 intN;longlongW,L;intmain(){cin>>N>>L>>W;longlongr=0;longlongans...
We will hold AtCoder Regular Contest 148. Contest URL: https://atcoder.jp/contests/arc148 Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20220911T2100&p1=248 Duration: 120 minutes Number of Tasks: 6 Writer: Nyaan Tester: maspy, satashun Rated range: — 2799 The...