摘要:
这题第一直觉就是和CF第三次教育场的E题是一样的, http://codeforces.com/contest/609/problem/E 然后直接拉过来代码改了改,提交返回MLE。FZU内存开的小,没救了。 后来还是同学指教,边总共只有两类,要么存在最少生成树上,要么不属于任何一个最小生成树。 所 阅读全文
摘要:
暴力枚举一下就可以得到答案。 #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<algorithm> #include<iostream> using namespace std; const i 阅读全文
摘要:
水题,直接比较一下就可以了 #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<algorithm> #include<iostream> using namespace std; int n; c 阅读全文
摘要:
水题,不过感觉数据有错。 #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<algorithm> #include<iostream> using namespace std; long long 阅读全文
摘要:
简单模拟题,开个栈维护一下即可。 #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<algorithm> #include<stack> #include<iostream> using name 阅读全文
摘要:
暴力DP。 dp[x1][y1][x2][y2][t]表示,第一个人在(X1,Y1),第二个人在(X2,Y2),时间为t的时候获得的最大价值。 时间复杂度o(t*n*m*n*m*5*5). 什么都不优化跑了4600ms,差点超时,剪了点枝,2500ms跑过。 空间复杂度是可以优化的,dp[x1][y 阅读全文
摘要:
按题意的步骤来显然是不行的。算一次最坏需要o(1000*1000*6)复杂度,需要算log(n*n)次,显然超时。 需要转换一下公式,考虑到K只有6,所以可以考虑转换成BA来做。 #include<cstdio> #include<cstring> #include<cmath> #include< 阅读全文