C. Jury Marks】的更多相关文章

C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be…
C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be…
C. Jury Marks 这个题目虽然是只有1600,但是还是挺思维的. 有点难想. 应该可以比较快的推出的是这个肯定和前缀和有关, x x+a1 x+a1+a2 x+a1+a2+a3... x+sum=b 所以我们可以通过b来枚举每一个x,如果这个x可以满足找到m个b,那就说明这个x是合理的. 但是要注意的是,这个sum的去重,为什么要去重呢,因为如果不去虫,就是找到两个相同的  因为x=b-sum 所以可以只要枚举b[1]即可,因为对于每一个b,其中一个确定之后,剩下的b的位置也固定了.…
http://codeforces.com/contest/831/problem/C 做的时候想不到,来了个暴力. 对于每个b[i],枚举每一个a[i],就有1个可能的情况. 然后用vector存起来,再判断.理论复杂度爆咋,过了综测717ms 正确的思路就是排一个序. 预处理前缀和suma_i,然后就相当于每一个数字只能选一次.从小到大排序. 从大到小排序b_i,枚举每一个suma_i,用b[1]确定一个初始值,然后跑完所有b_i,看看suma_i那里有没有就行了. #include <bi…
思路: 关键在于“插入”一个得分之后,其他所有得分也随之确定了. 实现: #include <iostream> #include <cstdio> #include <set> using namespace std; ; int a[MAXN], b[MAXN], sum[MAXN]; int main() { int k, n; set<int> ans; cin >> k >> n; ; i <= k; i++) { c…
[Link]:http://codeforces.com/contest/831/problem/C [Description] 有一个人参加一个比赛; 他一开始有一个初始分数x; 有k个评委要依次对这个人评分; 依照时间顺序依次给出这k个人的评分(可能为负数,负数的时候,表示分数会降低,而如果为正,则分数增加); 然后有一个人记得这k次评分中的n次评分过后这个人的评分; (即知道其中k个评委评完分之后,那个人的k个即时分数) (这k个分数各不相同); 问你x有多少种不同可能; [Solutio…
题目链接 :http://codeforces.com/contest/831/problem/C 题意 :选手有一个初始积分,接下来有k个裁判为他加分或减分(时间顺序给出),然后告诉你n(1<=n<=k)个积分减分过程中的积分(不一定是时间顺序),问根据这些信息,他的初始积分有多少种可能 分析 : 无论存在多少种,先明确一点,只要存在那么这n个分数肯定是能够找到自己的位置的(也就是每个分数是在哪个裁判给分之后的值).那么我们就可以找其中一个出来,将其放在各个裁判判分之后的位置,有k个裁判,那…
http://codeforces.com/contest/831 A. Unimodal Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Array of integers is unimodal, if: it is strictly increasing in the beginning; after that…
A. Unimodal Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is constant; after that it is…
C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be…
http://poj.org/problem?id=1015 题目大意:在遥远的国家佛罗布尼亚,嫌犯是否有罪,须由陪审团决定.陪审团是由法官从公众中挑选的.先随机挑选n个人作为陪审团的候选人,然后再从这n个人中选m人组成陪审团.选m人的办法是:控方和辩方会根据对候选人的喜欢程度,给所有候选人打分,分值从0到20.为了公平起见,法官选出陪审团的原则是:选出的m个人,必须满足辩方总分和控方总分的差的绝对值最小.如果有多种选择方案的辩方总分和控方总分的之差的绝对值相同,那么选辩控双方总分之和最大的方案…
2400: Spoj 839 Optimal Marks Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 567  Solved: 202[Submit][Status][Discuss] Description 定义无向图中的一条边的值为:这条边连接的两个点的值的异或值. 定义一个无向图的值为:这个无向图所有边的值的和. 给你一个有n个结点m条边的无向图.其中的一些点的值是给定的,而其余的点的值由你决定(但要求均为非负数),使得这个无向图的值最小…
题目大意:要求你从n个人中选出m个,每个人有两个值p[i],D[i],要求选出的人p总和与D总和的差值最小.若有相同解,则输出p总+D总最大的方案. 动态规划. 一直在想到底是n枚举外面还是m放外面,好像两者都可以? 做了越来越多的那种“当前层改变下一层”,乍一看题解还以为这是道斜率优化呢. #include<cstdio> #include<cstring> #include<algorithm> #define inf 1000000000 using namesp…
http://poj.org/problem?id=1015 (题目链接) 题意 随机挑选n个人作为陪审团的候选人,然后再从这n个人中选m 人组成陪审团.选m人的办法是:控方和辩方会根据对候选人的喜欢程度,给所有候选人打分,分值从0 到20.为了公平起见,法官选出陪审团的原则是:选出的m个人,必须满足辩方总分D和控方总分P的差的绝对值|D-P|最小.如果有多种选择方案的 |D-P| 值相同,那么选辩控双方总分之和D+P最大的方案即可. Solution 源自:http://blog.csdn.n…
题目传送门 /* 贪心:首先要注意,y是中位数的要求:先把其他的都设置为1,那么最多有(n-1)/2个比y小的,cnt记录比y小的个数 num1是输出的1的个数,numy是除此之外的数都为y,此时的numy是最少需要的,这样才可能中位数大于等于y */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace std; ; con…
(poj.org issue. Not submitted yet) This is a 2D DP problem, very classic too. Since I'm just learning, so I took this link as reference: http://blog.csdn.net/lyy289065406/article/details/6671105 1. It is a little tricky to pick dependent values for t…
You are given an undirected graph G(V, E). Each vertex has a mark which is an integer from the range [0..231 – 1]. Different vertexes may have the same mark. For an edge (u, v), we define Cost(u, v) = mark[u] xor mark[v]. Now we know the marks of som…
1.链接地址: http://bailian.openjudge.cn/practice/2979 http://poj.org/problem?id=1015 2.题目: 总Time Limit: 1000ms Memory Limit: 65536kB Description 在遥远的国家佛罗布尼亚,嫌犯是否有罪,须由陪审团决定.陪审团是由法官从公众中挑选的.先随机挑选n个人作为陪审团的候选人,然后再从这n个人中选m人组成陪审团.选m人的办法是: 控 方和辩方会根据对候选人的喜欢程度,给所有…
题意: 在遥远的国家佛罗布尼亚,嫌犯是否有罪,须由陪审团决定.陪审团是由法官从公众中挑选的.先随机挑选n个人作为陪审团的候选人,然后再从这n个人中选m人组成陪审团.选m人的办法是:控方和辩方会根据对候选人的喜欢程度,给所有候选人打分,分值从0到20.为了公平起见,法官选出陪审团的原则是:选出的m个人,必须满足辩方总分和控方总 分的差的绝对值最小.如果有多种选择方案的辩方总分和控方总分的之差的绝对值相同,那么选辩控双方总分之和最大的方案即可. 思路:详见代码 #include<cstdio> #…
Little Vova studies programming to p. Vova is very smart and he can write every test for any mark, but he doesn't want to stand out from the crowd too much. If the sum of his marks for all tests exceeds value x, then his classmates notice how smart h…
OPTM - Optimal Marks You are given an undirected graph G(V, E). Each vertex has a mark which is an integer from the range [0..231 – 1]. Different vertexes may have the same mark. For an edge (u, v), we define Cost(u, v) = mark[u] xor mark[v]. Now we…
题意:n个陪审团,每个陪审团有x,y值,选出m个陪审团,要求 (sum(xi)-sum(yi))最少,当 (sum(xi)-sum(yi))最少有多个,取sum(xi)+sum(yi)最大那个 ,并顺序输出陪审团的序号 思路:先x-y,x+y存起来,再按当dp[i][j],j相同时,要值最大,当然存路径是最烦的. #include <iostream> #include<cstdio> #include <cstring> #include<algorithm&g…
B. School Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Vova studies programming in an elite school. Vova and his classmates are supposed to writen progress tests, for each…
感觉此题略难...... 背包问题.据说有一种二维DP的写法是错的.亲测,背包做法无误. dp[i][j][k]表示前i个物品,选择j个,差值为k的情况下获得的最大总和 dp[i][j][k]=max(dp[i-1][j][k],dp[i-1][j-1][k-差]+和) 即第i个物品用或者不用. DP完成之后,在表中寻找一下最优解即可. #include<cstdio> #include<cstring> #include<cmath> #include<stac…
In Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general public. Every time a trial is set to begin, a jury has to be selected, which is done as follows. First, several people are draw…
You are given an undirected graph G(V, E). Each vertex has a mark which is an integer from the range [0..231 – 1]. Different vertexes may have the same mark. For an edge (u, v), we define Cost(u, v) = mark[u] xor mark[v]. Now we know the marks of som…
  1  Preface DB Query Analyzer is presented by Master Gen feng, Ma from Chinese Mainland. It has English version named 'DB Query Analyzer' and Simplified Chinese version named '万能数据库查询分析器(DB 查询分析器)'. Out of question, DB Query Analyzer is one of the f…
01背包 我们对于这类选或者不选的模型应该先思考能否用01背包来解. 毫无疑问物体的价值可以看成最大的d+p值,那么体积呢?题目的另一个限制条件是d-p的和的绝对值最小,这启发我们把每个物体的d-p的值当作体积. 可以尝试设计状态f[i, j, k]表示从前i个物品中选j个,体积是k的最大价值. 同样的,我们可以用滚动数组的方法把第一维i去掉. 那么得到状态转移方程: f[j, k] = max(f[j - 1, k - d[i] - p[i]] + d[i] + p[i], f[j, k])…
In Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general public. Every time a trial is set to begin, a jury has to be selected, which is done as follows. First, several people are draw…
Jury Compromise Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 33737   Accepted: 9109   Special Judge Description In Frobnia, a far-away country, the verdicts in court trials are determined by a jury consisting of members of the general…