目录 Codeforces 1000 A.Codehorses T-shirts B.Light It Up C.Covered Points Count(差分) D.Yet Another Problem On a Subsequence(DP) E.We Need More Bosses(圆方树) \(Description\) \(Solution\) F.One Occurrence(线段树) \(Description\) \(Solution\) G.Two-Paths(树形DP)…
Bryce1010模板 http://codeforces.com/contest/1000/problem/E 题意: 给一个无向图,求图的最长直径. 思路:对无向图缩点以后,求图的最长直径 #include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=600010; int From[maxn],Laxt[maxn],To[maxn<<2],Next[maxn<<2]…
Bryce1010模板 http://codeforces.com/problemset/problem/1000/B 思路:先用两个数组sumon[]和sumoff[]将亮着的灯和灭的灯累计一下. 然后从左到右扫描插入一个开关,取得到的最大值. #include<bits/stdc++.h> using namespace std; #define ll long long const int MAXN=1e5+10; ll sumon[MAXN]; ll sumoff[MAXN]; ll…
A - Codehorses T-shirts 思路:有相同抵消,没有相同的对答案+1 #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define pii pair<int, int> using namespace std; ; ; const int inf = 0x3f3f3f3f; const LL INF = 0x3…