Codeforce 215 div1】的更多相关文章

C 把每个qi看成点,则问题转化为:求一个最大的k,遍历k个点的完全图需要的最小步数+1不超过n, (这里+1的原因是把起点加进去) 讨论k的奇偶: k为奇数,每个点度数为偶数,这是一个欧拉回路,步数为边数; k为偶数,每个点度数为奇数,保留2个奇度数点,将剩下的点度数改造成偶数,需要(k-2)/2步,然后得到一个欧拉图; 于是得到公式. D 考虑d个数属于的集合mask,那么可以确定 总集合^mask 的集合是不符合要求的(它的子集也是不符合要求的),于是可以排除所有的"bad mask&qu…
A 假设只有一个连通块,任选一个点入队,按bfs/dfs序删除即可. trick: 要考虑有多个连通块的情况,不一定无解. #define rep(i,n) for(int i=0 ; i<(n) ; i++) #define mid ((l+r)>>1) #define ls ((rt<<1)) #define rs ((rt<<1)+1) #define maxn 510 char g[maxn][maxn]; bool vis[maxn][maxn]; in…
A 只要打个表就能发现,1,6,8,9的所有排列就可以产生0~6的余数了... 所以...走不下去的时候一定要打表... #define rep(i,n) for(int i=0 ; i<(n) ; i++) #define mid ((l+r)>>1) #define ls ((rt<<1)) #define rs ((rt<<1)+1) #define maxn 1000100 char s[maxn]; ]; ],m[]={,,,}; int getr(st…
B 4D"部分和"问题,相当于2D部分和的拓展,我是分解成2D部分和做的: f[x1][y1][x2][y2]=true/false 表示 左上(x1,y1) 右下(x2,y2)的矩形是否是good rectangle; p1[][]x][y]表示右下为(x,y)的good rectangle有多少个,相当于一个[x][y]确定的2D前缀和; t[i][j][x][y]表示左上在矩形 (i,j) (x,y) 区域内 右下确定为(x,y)的方案数有多少个,可以o(1)计算: t[i][j…
题目地址: 选题为入门的Codeforce div2/div1的C题和D题. 题解: A:CF思维联系–CodeForces -214C (拓扑排序+思维+贪心) B:CF–思维练习-- CodeForces - 215C - Crosses(思维题) C:CF–思维练习–CodeForces - 216C - Hiring Staff (思维+模拟) D:CF思维联系–CodeForces-217C C. Formurosa(这题鸽了) E:CF思维联系–CodeForces - 218C E…
还以为就这么点分了,不会跪了,起码有点加,生活都这么艰难了,为什么不让我好好地活下去! 是不是世界对我充满了恶意! 当然还是自己太菜! B题没初始化第一个就杯具了一次 C题大概的弄出来了,调了半个小时,感觉不用心一样,虽然最后还是有了新bug的发现可是也来不及了! 妈蛋,现在看早就是对了的了, 一没看清就交了,判断去掉了,条件都不记得加!…
论蒟蒻如何被cf虐 以下是身败名裂后的题解菌=========== Div1 A.Watchmen 有n个点,每个点有一个坐标.求曼哈顿距离=欧几里得距离的点对数量. 只需要统计x或y一样的点对数量.容斥即可.注意long long.(sad story //By zzq #include <iostream> #include <stdio.h> #include <stdlib.h> #include <algorithm> #include <s…
Problem Statement      You are a genealogist specializing in family trees of vampires. Vampire family trees differ from human family trees. In particular, vampires are "born" in a different way. The only way to create a new vampire is that an ex…
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js" ></script> </head&g…
Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is a lamp in a block, it will light it’s block and the direct adjacent blocks. For example, if there is a lamp at block 3, it will light the blocks 2, 3…