Codeforces Round #397 题解】的更多相关文章

Problem A. Neverending competitions 题目大意 一个团队有多个比赛,每次去比赛都会先订机票去比赛地点,然后再订机票返回.给出\(n\)个含有起止地点的购票记录(不按时间顺序),判断这个团队是否返回. 题解 竞速题 因为每次比赛都必定是一去一返 所以当订票记录个数为偶数的时候一定在家中,否则一定在比赛. Code a = input() if a % 2 == 0: print 'home' else: print 'contest' Problem B. Cod…
Codeforces Round #556 题解 Div.2 A Stock Arbitraging 傻逼题 Div.2 B Tiling Challenge 傻逼题 Div.1 A Prefix Sum Primes 傻逼题,先放2,1然后放完2然后放完1 Div.1 B Three Religions 有三个字符串\(s_1,s_2,s_3\)和一个主串\(s\),每次操作改变一个\(s_i\)(插入或删除字符),每次操作完之后问\(s\)是否可以分成\(3\)个子序列正好是\(s_1,s_…
Codeforces Round #569 题解 CF1179A Valeriy and Deque 有一个双端队列,每次取队首两个值,将较小值移动到队尾,较大值位置不变.多组询问求第\(m\)次操作时队首两个数. 显然\(O(n)\)次以内队首变成了最大值,之后就循环了,暴力前\(O(n)\)个操作的答案即可 https://codeforces.com/contest/1179/submission/55878330 CF1179B Tolik and His Uncle 有一个\(n*m\…
Codeforces Round #557 题解 掉分快乐 CF1161A Hide and Seek Alice和Bob在玩捉♂迷♂藏,有\(n\)个格子,Bob会检查\(k\)次,第\(i\)次检查第\(x_i\)个格子,如果Alice在这个格子就输了.Alice一开始会在一个格子,可以在Bob检查过一次后向一个相邻的格子移动(整局游戏只能用一次).求Alice有多少种方案赢. 两个方案相同当且仅当Bob检查之前Alice的位置和Bob做完所有检查之后Alice的位置都相同. cao,sb阅…
CFEducational Codeforces Round 66题解报告 感觉丧失了唯一一次能在CF上超过wqy的机会QAQ A 不管 B 不能直接累计乘法打\(tag\),要直接跳 C 考虑二分第\(k\)小的值 那么问题就变成了 每一个数变成了\([x-mid,x+mid]\)的一段区间,如果有一个位置被覆盖了超过\(k\)次 那么\(mid\)一定合法 类似括号匹配 每次碰到左端点就贡献+1 右端点就统计答案然后-1 维护答案的同时顺便维护位置就好了 #include<cstdio>…
Codeforces Round #542 abstract I决策中的独立性, II联通块染色板子 IIIVoronoi diagram O(N^2 logN) VI环上距离分类讨论加取模,最值中的决定性元素 V代数构造 B 题意 2n个数排成一行,1..n各出现两次,两个人分别从1按顺序走到n(每个数只能被一个人路过),问他们两个人的距离和的最小值(两个数之间的距离等于他们位置(下标)值差)? 题解 将每个数的两个位置用pair存起来(eg : pos[1].x , pos[1].y). 首…
F. Souvenirs 题目连接: http://codeforces.com/contest/765/problem/F Description Artsem is on vacation and wants to buy souvenirs for his two teammates. There are n souvenir shops along the street. In i-th shop Artsem can buy one souvenir for ai dollars, a…
E. Tree Folding 题目连接: http://codeforces.com/contest/765/problem/E Description Vanya wants to minimize a tree. He can perform the following operation multiple times: choose a vertex v, and two disjoint (except for v) paths of equal length a0 = v, a1,…
D. Artsem and Saunders 题目连接: http://codeforces.com/contest/765/problem/D Description Artsem has a friend Saunders from University of Chicago. Saunders presented him with the following problem. Let [n] denote the set {1, ..., n}. We will also write f:…
C. Table Tennis Game 2 题目连接: http://codeforces.com/contest/765/problem/C Description Misha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won by one of the players, he receives one point and the lo…