Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of nproblems, and they want to select any non-empty subset of it as a problemset. k experienced teams are participating i…
题目链接:868C - Qualification Rounds 题目大意:有\(n\)个题目,\(k\)个人,每个人可能做过这\(n\)个题里的若干道,出题方要在这\(n\)个题目里选若干个出来作为一套题.称一套题有趣的当且仅当对于任意一个人,他在这套题里做过的题目数不超过总题数的一半,问是否存在这样的一套题. 题解:设第\(i\)道题有\(p_i\)个人做过,显然当存在有\(p_i =0\)时单独把这道题放入套题里即可. 若存在\(p_i =1\),设做过这道题的人为\(X\),则只需要找到…
原题链接:http://codeforces.com/problemset/problem/868/C 题意:有k个队伍参加比赛,比赛有n个预选的题目,有些队伍对已经事先知道了一些题目.问能不能选出若干个题,使没有队伍提前知道了半数以上的比赛题目. 思路:可以肯定的是,只要存在满足条件的选题方案,必定存在两道题,选上这两道之后也是满足条件的.因为k<=4,我们可以用二进制数记录题目的被提前知道的情况.所以,只要存在两个题目,对应的二进制数的异或结果为0,输出YES,否则输出NO.具体实现参看代码…
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset. k experienced teams are participating…
[题目]C. Qualification Rounds [题意]给定n个问题和K个人,给定每个人知道的问题列表,求能否找到一个非空问题集合,满足每个人知道的集合中问题数量都不超过集合总题数的一半.n<=10^5,k<=4. [算法]数学结论 [题解]当k<=4时,结论:若存在合法方案,则一定存在选择2个问题的合法方案. 证明:对于选择偶数个问题的合法方案(奇数不优),假设方案中每个人都知道一半问题(最坏),试图从中得到选择2个问题的合法方案. 先得到三条易证的结论: Ⅰ两个人知道区间互补…
You are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations are performed, on each of them you concatenate two existing strings into a new one. On the i-th operation the concatenation saisbi is saved into a new string sn + …
C. Industrial Nim time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output There are n stone quarries in Petrograd. Each quarry owns mi dumpers (1 ≤ i ≤ n). It is known that the first dumper of the…
原题链接:http://codeforces.com/problemset/problem/878/A 题意:给出n个位运算操作, 化简这些操作, 使化简后的操作次数不多于5步. 思路:我们可以对二进制每一位上的1, 0, 进行讨论, 如果n次操作后1 -->1, 0 --> 1, 说明这一位要用或操作(or 1) 类似的,1 -->0, 0 -->1, 说明这一位要用异或操作(xor 1)        1 -->0, 0 -->0, 说明这一位要用与操作(and 0…
题意 https://vjudge.net/problem/CodeForces-1230D 要组建一个小组,要求小组中每个人都不比所有人强,当一个人懂得一个算法但是另一个不懂那么前者认为他比后者强.所以这个小组要满足一个人懂得算法必定有另一个人全懂.每个人的技能是不同的,要求出这个小组能组成的技能最大值. 思路 先遍历一遍,用map记录a[i](会的算法)的个数,出现次数大于等于2的a[i],是肯定可以放到小组里的,因为有人和他的懂的相同. 然后对出现次数小于2的人,和刚才确定的人的对比,如果…
F - Qualification Rounds CodeForces - 868C 这个题目不会,上网查了一下,发现一个结论就是如果是可以的,那么两个肯定可以满足. 然后就用二进制来压一下这个状态就可以了. #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <queue> #include <vector> #i…