随笔分类 - ACM-OJ-Codeforces
摘要:CodeForces 628E CodeForces 617E CodeForces 618E CodeForces 620E dfs序+线段树+set存颜色T了。 我竟然没想到可以用long long来存颜色,这次吸取教训了。 #include <bits/stdc++.h> using name
阅读全文
摘要:http://codeforces.com/contest/877/problem/E 真的菜的不行,自己敲一个模板,到处都是问题。哎
阅读全文
摘要:DNA Evolution 题目让我们联想到树状数组或者线段树,但是如果像普通那样子统计一段的和,空间会爆炸。 所以我们想怎样可以表示一段区间的字符串。 学习一发大佬的解法。 开一个C[10][10][4][n],就可以啦,第二维表示e的长度,第一维表示i%e的长度,第三维表示颜色,第四维求和了。
阅读全文
摘要:昨天打了场cf,只做出第一道水题,而和我同级的队员都做出三道题,有点难过,落下太多,剩下的唯有好好补题。 Sagheer, the Hausmeister 昨天比赛时候写的BFS,到最后不好对上面有没有进行判断。 今天早上花一个半小时软磨硬泡出来的DFS 1 #include <bits/stdc+
阅读全文
摘要:Straight <<A>> 暴力模拟一下。 #include <iostream> #include <algorithm> #include <cmath> using namespace std; int main() { int n,k; cin>>n>>k; double sum = 0;
阅读全文
摘要:题目链接:http://codeforces.com/contest/743/problem/D 好长时间没写树DP了,从打完比赛那天就一直想怎么写,感觉很生疏。写第二个DFS时卡了,请教了老房,学了一发他的UMAX,很巧妙。 #include <iostream> #include <cstdio
阅读全文
摘要:套题链接:http://codeforces.com/contest/732 B题Cormen The Best Friend Of a Man贪心的考虑一下,只要相邻两位之和不小于k即可。 1 #include <iostream> 2 #include <cstdio> 3 #include <
阅读全文
摘要:C.Hidden Word 链接:http://codeforces.com/contest/725/problem/C 昨天打比赛时没弄清楚题意,不过现在对题意还有怀疑,You’re given a string s which consists of 27 upper-case English
阅读全文
摘要:题目链接:D. Lakes in Berland time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The map of Berl
阅读全文
摘要:C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Eart
阅读全文
摘要:C. Reberland Linguistics time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output First-rate speci
阅读全文
摘要:D. Directed Roads time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder and Chris
阅读全文
摘要:C. Coloring Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder and Chris
阅读全文
摘要:D. Vasiliy's Multiset time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Author has gone ou
阅读全文
摘要:E. Connecting Universities time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output E. Connecting
阅读全文
摘要:D. As Fast As Possible time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output D. As Fast As Poss
阅读全文
摘要:题目链接: C. They Are Everywhere time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Sergei B.,
阅读全文
摘要:D. Recover the String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For each string s c
阅读全文
摘要:题目链接:http://codeforces.com/contest/707/my 看了这位大神的详细分析,一下子明白了。链接:http://blog.csdn.net/queuelovestack/article/details/52269321 搞了两天,终于彻底理解了。本来觉得怎么也不可能和D
阅读全文
摘要:留个扩展gcd求逆元的板子。 设i,j为每颗苹果树的位置,因为gcd(n,dx) = 1,gcd(n,dy) = 1,所以当走了n步后,x从0~n-1,y从0~n-1都访问过,但x,y不相同. 所以,x肯定要经过0点,所以我只需要求y点就可以了。 i,j为每颗苹果树的位置,设在经过了a步后,i到达了
阅读全文