F - Qualification Rounds CodeForces - 868C 这个题目不会,上网查了一下,发现一个结论就是如果是可以的,那么两个肯定可以满足. 然后就用二进制来压一下这个状态就可以了. #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <queue> #include <vector> #i…
题目链接:868C - Qualification Rounds 题目大意:有\(n\)个题目,\(k\)个人,每个人可能做过这\(n\)个题里的若干道,出题方要在这\(n\)个题目里选若干个出来作为一套题.称一套题有趣的当且仅当对于任意一个人,他在这套题里做过的题目数不超过总题数的一半,问是否存在这样的一套题. 题解:设第\(i\)道题有\(p_i\)个人做过,显然当存在有\(p_i =0\)时单独把这道题放入套题里即可. 若存在\(p_i =1\),设做过这道题的人为\(X\),则只需要找到…
[题目]C. Qualification Rounds [题意]给定n个问题和K个人,给定每个人知道的问题列表,求能否找到一个非空问题集合,满足每个人知道的集合中问题数量都不超过集合总题数的一半.n<=10^5,k<=4. [算法]数学结论 [题解]当k<=4时,结论:若存在合法方案,则一定存在选择2个问题的合法方案. 证明:对于选择偶数个问题的合法方案(奇数不优),假设方案中每个人都知道一半问题(最坏),试图从中得到选择2个问题的合法方案. 先得到三条易证的结论: Ⅰ两个人知道区间互补…
C. Qualification Rounds time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They…
C. Qualification Rounds time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They…
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…
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…
原题链接:http://codeforces.com/problemset/problem/868/C 题意:有k个队伍参加比赛,比赛有n个预选的题目,有些队伍对已经事先知道了一些题目.问能不能选出若干个题,使没有队伍提前知道了半数以上的比赛题目. 思路:可以肯定的是,只要存在满足条件的选题方案,必定存在两道题,选上这两道之后也是满足条件的.因为k<=4,我们可以用二进制数记录题目的被提前知道的情况.所以,只要存在两个题目,对应的二进制数的异或结果为0,输出YES,否则输出NO.具体实现参看代码…
Description 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 pa…
题目链接 传送门 题意 现总共有\(n\)个题目\(k\)支参赛队伍,已知每个题目各队伍是否会写,现问你能否从题目中选出一个子序列使得每支队伍最多只会写一半的题目. 思路 对于每个题目我们用二进制压缩所有队伍的情况,然后通过枚举状态看是否存在两种完全不同的状态是否同时出现过. 代码实现如下 #include <set> #include <map> #include <deque> #include <queue> #include <stack>…