Fennec VS. Snuke --AtCoder】的更多相关文章

题目描述 Fennec and Snuke are playing a board game.On the board, there are N cells numbered 1 through N, and N−1 roads, each connecting two cells. Cell ai is adjacent to Cell bi through the i-th road. Every cell can be reached from every other cell by re…
D - Fennec VS. Snuke Time limit : 2sec / Memory limit : 256MB Score : 400 points Problem Statement Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N−1 roads, each connecting two cells. Cell ai is a…
AtCoder Regular Contest 078 D - Fennec VS. Snuke 题意 给一个树,1是白色,n是黑色,其它没有颜色.Fennec每次可以染白色点的直接邻居为白色.Snuke则染黑色点的邻居为黑色.谁先不能动就输了.问谁赢. 题解 先找出1到n的唯一路径path[1..len],然后Fennec可以依次取1到len/2的点及其不在路径上的孩子.剩下的就是Snuke的.谁多就谁赢了. 代码 #include <cstdio> #define N 100005 int…
Fennec VS. Snuke Time limit : 2sec / Memory limit : 256MB Score : 400 points Problem Statement Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N−1 roads, each connecting two cells. Cell ai is adjac…
题目描述 Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N−1 roads, each connecting two cells. Cell ai is adjacent to Cell bi through the i-th road. Every cell can be reached from every other cell by r…
题目大意: 给定一棵n个结点的树 一开始黑方占据1号结点,白方占据n号结点 其他结点都没有颜色 每次黑方可以选择黑色结点临近的未染色结点,染成黑色 白方同理. 最后谁不能走谁输. 题解: 其实简单想想就可以想明白. 黑方肯定要往通往白方的最短路延伸,白方也是这样. 因为这样每次你可以最大化可行动次数. 所以先以1为根,dfs一遍,然后找到路径. 模拟一下走路径的过程,路径走光了就比谁的可行动次数多(有点像围棋的气的感觉),输出结果就可以了 #include <iostream> #includ…
我好菜啊,ARC注定出不了F系列.要是出了说不定就橙了. C - Splitting Pile 题意:把序列分成左右两部分,使得两边和之差最小. #include<cstdio> #include<algorithm> #define MN 2100001 using namespace std; int n,m,a[MN]; ,sum2=,mmh=1e18; ?-x:x;} int main(){ scanf("%d",&n); ;i<=n;i+…
C - Splitting Pile 枚举从哪里开始分的即可 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space putchar(' ') #define enter putchar('\n') #define MAXN 200005 #define e…
D - Fennec VS. Snuke Time limit : 2sec / Memory limit : 256MB Score : 400 points Problem Statement Fennec and Snuke are playing a board game. On the board, there are N cells numbered 1 through N, and N−1 roads, each connecting two cells. Cell ai is a…
Problem Statement We have a grid with H rows and W columns. At first, all cells were painted white. Snuke painted N of these cells. The i-th ( 1≤i≤N ) cell he painted is the cell at the ai-th row and bi-th column. Compute the following: For each inte…