链接:https://codeforces.com/contest/1169/problem/A 题意: The circle line of the Roflanpolis subway has nn stations. There are two parallel routes in the subway. The first one visits stations in order 1→2→…→n→1→2→…1→2→…→n→1→2→… (so the next stop after sta…
A - Circle Metro 模拟几百步就可以了. B - Pairs 爆搜一下,时间复杂度大概是 $O(4 * n)$ Code: 56306723 C - Increasing by Modulo 二分答案,然后验证一下就好了,第一个数越小越好,之后的数都要求和前一个相等或者大一点.复杂度 $n * log(n)$ D - Good Triple 对于每一个 $i$,需要计算出最小的 $x$,使得 $s[i-x] = s[x] = s[i + x]$,对于 $i$ 而言,如果区间左端点在…
链接:https://codeforces.com/contest/1169/problem/C 题意: Toad Zitz has an array of integers, each integer is between 00 and m−1m−1 inclusive. The integers are a1,a2,…,ana1,a2,…,an. In one operation Zitz can choose an integer kk and kk indices i1,i2,…,iki…
链接:https://codeforces.com/contest/1169/problem/B 题意: Toad Ivan has mm pairs of integers, each integer is between 11 and nn, inclusive. The pairs are (a1,b1),(a2,b2),…,(am,bm)(a1,b1),(a2,b2),…,(am,bm). He asks you to check if there exist two integers …
Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque 题意: 给\(n(n <= 1000)\)个圆,圆与圆之间不存在相交关系,只存在包含与不包含关系,现在问你把这一堆圆分成两组,求每组圆的异或并和的最大值. 思路:最简单的做法是贪心的做法,算出每个圆被包含的次数,为偶数则贡献为正,奇数为贡献为负. 现在主要学习一下树形dp的做法 由于圆不存在相交的情况,所以可以把所有的圆建成树,即把每棵树上的点分成两组,分别建成…
Codeforces Round #579 (Div. 3) 传送门 A. Circle of Students 这题我是直接把正序.逆序的两种放在数组里面直接判断. Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 205; int q, n; int a[N], b[N], c[N]; int main() { ios::sync_with_stdio(false);…
Codeforces Round #564 (Div. 1) A Nauuo and Cards 首先如果牌库中最后的牌是\(1,2,\cdots, k\),那么就模拟一下能不能每次打出第\(k+i\)张牌. 然后考虑每一张牌打出后还要打多少张牌以及这张牌是什么时候入手的,分别记为\(f_i,g_i\),那么答案就是\(f_i+g_i\)的最大值. #include<bits/stdc++.h> #define qmin(x,y) (x=min(x,y)) #define qmax(x,y)…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…