CF755F PolandBalls and Gifts】的更多相关文章

题意:给你一个礼物的置换.有k个人忘带了礼物.一个人无法获得礼物为他自己没有带礼物或给他带礼物的那个人没有带礼物.求选择k个人,没有获得礼物的人数的最小值和最大值. n,k<=1e6. 标程: #include<cstdio> #include<algorithm> #include<cstring> using namespace std; int read() { ,f=;char ch=getchar(); ;ch=getchar();} )+(x<&…
PolandBall and Gifts 转换成置换群后, 对于最大值我们很好处理. 对于最小值, 只跟若干个圈能否刚好组能 k 有关. 最直观的想法就是bitset优化背包, 直接搞肯定T掉. 我们能再发掘一些性质, 就是本质不能的圈的大小最多有sqrt(n)个, 因为1 + 2 + 3 ... + n = (n + 1) * n / 2 所以对于每个不同的数二进制优化一下就可以过啦. 感觉这种题就很有意思.. #include<bits/stdc++.h> #define LL long…
Gifts 感觉题解写的就是坨不知道什么东西.. 看得这个题解. #include<bits/stdc++.h> #define LL long long #define LD long double #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int&…
D. Gifts by the List 题目连接: http://www.codeforces.com/contest/681/problem/D Description Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's fam…
题目链接: 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.…
圣诞老人的礼物-Santa Clau’s Gifts  Descriptions: 圣诞节来临了,在城市A中圣诞老人准备分发糖果,现在有多箱不同的糖果,每箱糖果有自己的价值和重量,每箱糖果都可以拆分成任意散装组合带走.圣诞老人的驯鹿最多只能承受一定重量的糖果,请问圣诞老人最多能带走多大价值的糖果. Input 第一行由两个部分组成,分别为糖果箱数正整数n(1 <= n <= 100),驯鹿能承受的最大重量正整数w(0 < w < 10000),两个数用空格隔开.其余n行每行对应一箱…
F. PolandBall and Gifts   It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi ≠ i for all i. Unfortun…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n…
Mr. Cui is working off-campus and he misses his girl friend very much. After a whole night tossing and turning, he decides to get to his girl friend's city and of course, with well-chosen gifts. He knows neither too low the price could a gift be sinc…
The    LED Keychain    makes it easy for people to carry their keys with them and carry them with them. It has become an indispensable object in our daily lives. Whether in the home, office, campsite or more, these LED keychains have become one of th…