【codeforces 755F】PolandBall and Gifts】的更多相关文章

[题目链接]:http://codeforces.com/contest/755/problem/F [题意] n个人; 计划是每个人都拿一个礼物来送给一个除了自己之外的人; 且如果一个人没有送出礼物,那么它和它送礼物的对象都得不到礼物; 但是已经知道有k个人会忘记带礼物来; 问最少有几个人收不到礼物,最多有多少个人收不到礼物 [题解] ① 对于最多的情况; 最后会形成多个环; 每个环隔一个人选一个人忘记带礼物;这样一个长度为len的环只要len/2个人没带礼物就能够整个环的人都收不到礼物了;…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output PolandBall is playing a game with EnemyBall. The rules are simple. Players have to say words in turns. You cannot say a word which was already sa…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integ…
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output PolandBall has such a convex polygon with n veritces that no three of its diagonals intersect at the same point. PolandBall decided to improve i…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output PolandBall lives in a forest with his family. There are some trees in the forest. Trees are undirected acyclic graphs with k vertices and k - 1 e…
[题目链接]:http://codeforces.com/contest/755/problem/E [题意] 给你n个节点; 让你在这些点之间接若干条边;构成原图(要求n个节点都联通) 然后分别求出原图和补图(补图也要求联通)的直径r1和r2 然后要求min(r1,r2)==k; 让你求出符合要求的原图的m条边; [题解] 有个结论; 如果图G的直径超过了3,则它的补图的直径会比3小; 且k=1的时候,是无解的; 因为k=1就说明一张图上只有一条边; n=2的时候,另外一张图上没边,最小值为0…
题目链接: F. PolandBall and Gifts time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall.…
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=2000),问满足[数列长度是k && 数列中每一个元素arr[i]在1~n之间 && 数列中元素可以重复]的数列有多少个?结果对10^9+7取余 解题思路:dp[i][j]表示长度是j,最后一位是i的种数 if(kk%i==0) dp[kk][j+1]+=dp[i][j] #inc…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Chri…
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q个操作; 有以下两种类型 ①将第i个连通块里面灯取反 ②询问你(x1,y1)(x2,y2)这个矩形区域内灯的权值的和; [题解] 要用到二维的树状数组; 取反操作只要O(1)就能完成; 即先不管它是什么,取反就是了; 然后在询问的时候,直接用二维树状数组累加; 这里的累加可能是减也可能是加; 也可能…