Codeforces Breaking Good】的更多相关文章

Breaking Good time limit per test 2 seconds memory limit per test 256 megabytes Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers. Walter Wi…
题目链接: http://codeforces.com/problemset/problem/507/E E. Breaking Good time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that…
传送门 E. Breaking Good time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is real…
[题目链接] https://codeforces.com/contest/507/problem/E [算法] 首先BFS求出1到其余点的最短路 , N到其余点的最短路,记为distA[]和distB[] 显然 , 我们只需最大化求出的最短路上没有被破坏的边即可 , 不妨用f[i]表示现在在城市i , distA[i] + distB[i] = distA[N] , 最多还能经过几条没有被破坏的边 记忆化搜索即可 时间复杂度 : O(N) [代码] #include<bits/stdc++.h…
Breaking Good 题解:         2维权重dij, 先距离最短, 后改变最小.   在这个题中, 如果要改变最小, 则让更多的可用边放进来. 然后可以用pre存下关键边.   代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w&qu…
E. Breaking Good time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really d…
You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move. There are nn doors, the ii-th door ini…
[题目链接]:https://vjudge.net/contest/164884#problem/D [题意] 给你一张图; 图中有些路是完好的;但有些路还没修好; 先不管路有没有修好; 问你从起点到终点的最短路; 如果最短路上有没修好的路,那么你要把它修好; 而不在最短路上的,如果是完好的路,你需要把它摧毁(???) 让你选出这么一条最短路,使得受影响的路(被摧毁的和修好的路的数目总和)最少; [题解] 受影响的路即是: 最短路上的没修好的路+非最短路上的修好的路; 也即; 最短路的长度-最短…
题意:有\(n\)扇门,你每次可以攻击某个门,使其hp减少\(x\)(\(\le 0\)后就不可修复了),之后警察会修复某个门,使其hp增加\(y\),问你最多可以破坏多少扇门? 题解:首先如果\(x>y\),那么我肯定全部都能破坏,否则,统计\(hp\le x\)的门的个数,谁先碰门谁先赢,而我是先手,所以能破坏的门的个数就是\(\lceil \frac{cnt}{2} \rceil\). 代码: int n,x,y; int a[N]; int main() { //ios::sync_wi…
D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d ki…