Codeforces Round #412 D. Dynamic Problem Scoring (枚举 + 贪心)
来源:互联网 发布:java excel导入导出 编辑:程序博客网 时间:2024/05/19 19:41
参考http://blog.csdn.net/dormousenone/article/details/71422868
题意对于动态计分的 Codeforces Round ,已知每题的 score 是根据 Round 参加人数和该题过题人数计算,两者之比结合上图得出该题的分数。某人在该题的得分为 score×(1−t/250) 其中 t 表示通过该题的时间。已知参加该场比赛的所有参加者的过题情况(包括 Vasya 和 Petya),问如何通过增加新的参赛者(尽量少),使得 Vasya 的最终得分高于 Petya。
#include<bits/stdc++.h>using namespace std;int n, a[120][5], cnt[5];int getScore(int pid, bool isPetya, int participants){ if(a[isPetya][pid] == -1) return 0; int maxPoint = 500, solved; if(a[0][pid] == -1 || a[1][pid] == -1 || a[0][pid] < a[1][pid]) { solved = cnt[pid]; } else { solved = participants - n + cnt[pid]; } for(int i=2;i<=32;i*=2) if(solved * i > participants) break; else maxPoint += 500; return maxPoint * (1.0 - a[isPetya][pid] / 250.0);}int main(){ scanf("%d",&n); for(int i=0;i<n;i++) for(int j=0;j<5;j++) { scanf("%d",&a[i][j]); if(a[i][j] != -1) cnt[j]++; } vector<int> v; v.push_back(n); for(int i=0;i<5;i++) for(int j=2;j<=32;j*=2) if(cnt[i]*j >= n) v.push_back(cnt[i]*j); sort(v.begin(), v.end()); for(int i=0;i<v.size();i++) { if(i && v[i] == v[i-1]) continue; int Vasya = 0, Petya = 0; for(int j=0;j<5;j++) Vasya += getScore(j, false, v[i]); for(int j=0;j<5;j++) Petya += getScore(j, true, v[i]); if(Vasya > Petya) { printf("%d\n", v[i] - n); return 0; } } printf("-1\n");}
阅读全文
0 0
- Codeforces Round #412 D. Dynamic Problem Scoring (枚举 + 贪心)
- Codeforces Round #412 D. Dynamic Problem Scoring (枚举 + 贪心)
- Codeforces Round #412 ( Div. 2) D. Dynamic Problem Scoring(贪心)
- codeforces 412 D Dynamic Problem Scoring
- codeforces D. Dynamic Problem Scoring
- codeforces807div2 D.Dynamic Problem Scoring[暴力][贪心]
- Codeforces Round #296 (Div. 2) - D. Clique Problem(贪心)
- 贪心(最大团)||dp+线段树(Codeforces Round #296 (Div. 2)D. Clique Problem)
- Codeforces Round #253 (Div. 2) D. Andrey and Problem (贪心+数学概率)
- Codeforces Beta Round #46 (Div. 2), problem: (D) Game 贪心YY
- Codeforces Round #394 (Div. 2) D. Dasha and Very Difficult Problem 贪心
- Codeforces Round #394 (Div. 2)D. Dasha and Very Difficult Problem【贪心】
- Codeforces Round #394 (Div. 2) D. Dasha and Very Difficult Problem 贪心,二分
- Codeforces Round #394 (Div. 2) D. Dasha and Very Difficult Problem —— 贪心
- Codeforces Round #339 (Div. 2) D. Skills(模拟+枚举)
- Codeforces Round #339 (Div. 2) D.Skills(贪心)
- Hot Days Codeforces Round #132 (Div. 2) D(贪心)
- Codeforces Round #276 (Div. 2)(C贪心,D)
- 1030 Dijkstra+DFS
- loadrunner测试springboot的api接口
- POJ 1035 Spell checker 串
- 内网容器化实践
- HDU 3746 Cyclic Nacklace(Next 数组性质)
- Codeforces Round #412 D. Dynamic Problem Scoring (枚举 + 贪心)
- 【08】Bootstrap — 按钮
- Python 学习6
- bzoj 1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐(暴力DFS)
- [ZJOI2016]线段树
- CodeForces
- 编写现代 CSS 代码的 20 个建议
- JavaScript模板引擎
- 3993: [SDOI2015]星际战争