cf 模拟】的更多相关文章

https://codeforces.com/contest/1236/problem/D 题意:一个n*m格子矩阵,放一个人偶在左上角向右走,只能在每个格子最多右转一次,有k个障碍物.求是否能够一次走完矩阵的所有非障碍物格然后停留在任意位置. 题解:在每个格子最多右转一次,相当于每个格子只能走一次,否则就出不来了.容易想到障碍物必须也是占据一些蛇形的片段,并且留下的位置刚好可以让人偶走一个蛇形的绕到中心,但是怎么判断障碍物的形状呢?百思不得其解遂看题解.题解表示观察到人偶撞墙或者撞障碍物必转向…
7月8号晚上8点和两位巨佬开了一场虚拟cf: [Helvetic Coding Contest 2018 online mirror (teams allowed, unrated)] 我这么蔡,只AC了A2.C1.C2.E1(被巨佬吊打) 我就说一下我写的几道题吧: A2. Death Stars (medium) The stardate is 1983, and Princess Heidi is getting better at detecting the Death Stars. T…
Codeforces Round #571 (Div. 2) 日常被tanao_大佬带飞,我AC了A和C(B题没了...否则tanao_大佬肯定把我吊打) A. Vus the Cossack and a Contest Vus the Cossack holds a programming competition, in which \(n\) people participate. He decided to award them all with pens and notebooks. I…
在家都变的懒惰了,好久没写题解了,补补CF 模拟 A - Wet Shark and Odd and Even #include <bits/stdc++.h> typedef long long ll; const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; int main(void) { std::vector<int> vec; int n; scanf ("%d", &n); ll sum = 0;…
题目链接:http://codeforces.com/problemset/problem/676/B 题意:一个n层的平面酒杯金字塔,如图,每个杯子的容量相同.现在往最顶部的一个杯子倒 t 杯酒,求流动结束后有多少个杯子被装满. 思路:每个局部的两代三个杯子的流动过程是一致的,因此可以用递归来模拟求解. 具体为:设add(cur, i, l)执行“往第 i 个杯子倒cur量的酒”,附加信息: i 位于第 l 层.若执行完剩余了surplus量的酒,则往 i 的下一层左右两侧的杯子各倒surpl…
题目链接:http://codeforces.com/contest/1154/problem/E 题意:两个人轮流取最大值与旁边k个数,问最后这所有的数分别被谁给取走了 分析:看这道题一点思路都没有,想不到模拟链表也该能想到线段树的啊 大部分AC代码是模拟链表的,写起来也更快,但我线段树很不熟,线段树的代码也写一份吧 另外,以后要养成一种习惯,除了主函数定义int main里有int外,其他地方统一用ll了,不要自己给自己挖坑..... 线段树: 意识到是线段树后我建树部分就拿不准怎么做,事实…
cf 443 D. Teams Formation(细节模拟题) 题意: 给出一个长为\(n\)的序列,重复\(m\)次形成一个新的序列,动态消除所有k个连续相同的数字,问最后会剩下多少个数(题目保证消除的顺序对答案不会造成影响) \(n <= 10^{5} ,m <= 10^{9} ,k <= 10^{9},a_i <= 10^{5}\) 思路: 直接上题解好了 首先要用栈预处理序列本身,然后考虑处理后的序列 比较头和尾是否能够消除,细节需要处理好. #include<bi…
Soldier and Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Two bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are…
D. Have You Ever Heard About the Word? time limit per test 6 seconds memory limit per test 256 megabytes input standard input output standard output A substring of a string is a contiguous subsequence of that string. So, string bca is substring of st…
随便模拟下就过了qwq 然后忘了特判WA了QwQ #include <cstdio> #include <algorithm> #include <cstring> #include <set> #include <queue> using namespace std; ],v[],fir[],nxt[],cnt=,dep[],squ[]; ]; void addedge(int ui,int vi){ cnt++; u[cnt]=ui; v[c…