codeforces 868C】的更多相关文章

F - Qualification Rounds CodeForces - 868C 这个题目不会,上网查了一下,发现一个结论就是如果是可以的,那么两个肯定可以满足. 然后就用二进制来压一下这个状态就可以了. #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <queue> #include <vector> #i…
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 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 [题意]给定n个问题和K个人,给定每个人知道的问题列表,求能否找到一个非空问题集合,满足每个人知道的集合中问题数量都不超过集合总题数的一半.n<=10^5,k<=4. [算法]数学结论 [题解]当k<=4时,结论:若存在合法方案,则一定存在选择2个问题的合法方案. 证明:对于选择偶数个问题的合法方案(奇数不优),假设方案中每个人都知道一半问题(最坏),试图从中得到选择2个问题的合法方案. 先得到三条易证的结论: Ⅰ两个人知道区间互补…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…