【题目链接】:http://codeforces.com/contest/807/problem/D

【题意】



给出n个人的比赛信息;

5道题

每道题,或是没被解决->用-1表示;

或者给出解题的所用的时间;

(每道题的分数与解决率有关,越高,分越低);

然后有个人想利用这个特点,注册很多个账号;

试图改变每道题的解决率,以期让自己的分数大于某个人;

如果这个人没有解决某道题的话;

那些新加入的人也不能解决那道题.

问最少需要注册多少个账号才能让你的分数大于某个人;

【题解】



顺序枚举加入了多少个人->k;

对于自己做得快的题,让这道题的解决率变低,让这题更有价值,即这k个人都没做对;

对于自己做得慢的题,让这道题的解决率变高,让这题价值变得低一点,即这k个人都做对了这题;

当然,对于你自己都没做对的题,你只能让他们都做不对这题啦



【Number Of WA】



1



【完整代码】

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define lson l,m,rt<<1
  4. #define rson m+1,r,rt<<1|1
  5. #define LL long long
  6. #define rep1(i,a,b) for (int i = a;i <= b;i++)
  7. #define rep2(i,a,b) for (int i = a;i >= b;i--)
  8. #define mp make_pair
  9. #define pb push_back
  10. #define fi first
  11. #define se second
  12. #define ms(x,y) memset(x,y,sizeof x)
  13. typedef pair<int,int> pii;
  14. typedef pair<LL,LL> pll;
  15. const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
  16. const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
  17. const double pi = acos(-1.0);
  18. const int N = 120+20;
  19. int n,solves[6],a[N][6],tsolves[6];
  20. int cal(int time,int ac,int tot)
  21. {
  22. if (time==-1) return 0;
  23. if (2*ac>tot) return 2*(250-time);
  24. if (4*ac>tot) return 4*(250-time);
  25. if (8*ac>tot) return 6*(250-time);
  26. if (16*ac>tot) return 8*(250-time);
  27. if (32*ac>tot) return 10*(250-time);
  28. return 12*(250-time);
  29. }
  30. bool check(int k)//k是枚举的添加的cheater参赛选手个数
  31. {
  32. rep1(i,1,5) tsolves[i] = solves[i];
  33. rep1(i,1,5)
  34. {
  35. if (a[1][i]!=-1)//需要先解决这个问题,新注册的账号才能提交正确的
  36. {
  37. if (a[2][i]==-1)
  38. {
  39. //keep the ratio
  40. }
  41. else
  42. if (a[1][i]>a[2][i])//如果用的时间比较长,让这个题的AC率
  43. //提高
  44. {
  45. tsolves[i]+=k;
  46. }
  47. }
  48. }
  49. int l = 0,r = 0;
  50. rep1(i,1,5)
  51. {
  52. l+=cal(a[1][i],tsolves[i],n+k);
  53. r+=cal(a[2][i],tsolves[i],n+k);
  54. }
  55. return l>r;
  56. }
  57. int main()
  58. {
  59. //freopen("D:\\rush.txt","r",stdin);
  60. ios::sync_with_stdio(false),cin.tie(0);//scanf,puts,printf not use
  61. cin >> n;
  62. rep1(i,1,n)
  63. {
  64. rep1(j,1,5)
  65. {
  66. cin >> a[i][j];
  67. if (a[i][j]!=-1)
  68. solves[j]++;
  69. }
  70. }
  71. rep1(i,0,n*33)
  72. {
  73. if (check(i))
  74. {
  75. cout <<i <<endl;
  76. return 0;
  77. }
  78. }
  79. cout <<-1<<endl;
  80. return 0;
  81. }

【codeforces 807D】Dynamic Problem Scoring的更多相关文章

  1. 【codeforces 527D】Clique Problem

    [题目链接]:http://codeforces.com/contest/527/problem/D [题意] 一维线段上有n个点 每个点有坐标和权值两个域分别为xi,wi; 任意一对点(i,j) 如 ...

  2. 【codeforces 793C】Mice problem

    [题目链接]:http://codeforces.com/contest/793/problem/C [题意] 给你每个点x轴移动速度,y轴移动速度; 问你有没有某个时刻,所有的点都"严格& ...

  3. 【26.09%】【codeforces 579C】A Problem about Polyline

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  4. 【codeforces 749A】Bachgold Problem

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  5. codeforces 807 D. Dynamic Problem Scoring(贪心+思维)

    题目链接:http://codeforces.com/contest/807/problem/D 题意:对于动态计分的 Codeforces Round ,已知每题的 score 是根据 Round ...

  6. 【Codeforces 1096D】Easy Problem

    [链接] 我是链接,点我呀:) [题意] 让你将一个字符串删掉一些字符. 使得字符串中不包含子序列"hard" 删掉每个字符的代价已知为ai 让你求出代价最小的方法. [题解] 设 ...

  7. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) D - Dynamic Problem Scoring

    地址:http://codeforces.com/contest/807/problem/D 题目: D. Dynamic Problem Scoring time limit per test 2 ...

  8. Codeforces Round #412 Div. 2 补题 D. Dynamic Problem Scoring

    D. Dynamic Problem Scoring time limit per test 2 seconds memory limit per test 256 megabytes input s ...

  9. AC日记——Dynamic Problem Scoring codeforces 807d

    Dynamic Problem Scoring 思路: 水题: 代码: #include <cstdio> #include <cstring> #include <io ...

随机推荐

  1. 跟我学Java多线程——线程池与堵塞队列

    前言 上一篇文章中我们将ThreadPoolExecutor进行了深入的学习和介绍,实际上我们在项目中应用的时候非常少有直接应用ThreadPoolExecutor来创建线程池的.在jdk的api中有 ...

  2. uva live 6827 Galaxy collision

    就是给出非常多点,要求分成两个集合,在同一个集合里的点要求随意两个之间的距离都大于5. 求一个集合.它的点数目是全部可能答案中最少的. 直接从随意一个点爆搜,把它范围内的点都丢到跟它不一样的集合里.不 ...

  3. POJ 3080 Blue Jeans (后缀数组)

    题目大意: 求出这些DNA序列中的最长且字典序最小的公共子串. 思路分析: 二分长度的答案,去height中扫描这个长度是否满足,一旦满足就立即输出.这样就能够保证字典序最小了. #include & ...

  4. ASP.NET Razor - C# and VB Code Syntax

    http://www.w3schools.com/aspnet/razor_syntax.asp Razor supports both C# (C sharp) and VB (Visual Bas ...

  5. 深入解析Dropout——基本思想:以概率P舍弃部分神经元,其它神经元以概率q=1-p被保留,舍去的神经元的输出都被设置为零

    深度学习网络大杀器之Dropout——深入解析Dropout  转自:https://yq.aliyun.com/articles/68901 摘要: 本文详细介绍了深度学习中dropout技巧的思想 ...

  6. 动画和图形:OpenGL ES

    在网络层,互联网提供所有应用程序都要使用的两种类型的服务,尽管目前理解这些服务的细节并不重要,但在所有TCP/IP概述中,都不能忽略他们: 无连接分组交付服务(Connectionless Packe ...

  7. ComboxBox控件、checklistbox控件和listbox控件的组合开发

    第一步:先创建一个WinForm窗体应用程序,按照下图所示的进行布局. 第二步:为ComboxBox控件.checklistbox控件和listbox控件和button控件设置属性 第三步:在代码中的 ...

  8. Android线程间异步通信机制源码分析

    本文首先从整体架构分析了Android整个线程间消息传递机制,然后从源码角度介绍了各个组件的作用和完成的任务.文中并未对基础概念进行介绍,关于threadLacal和垃圾回收等等机制请自行研究. 基础 ...

  9. 基于jQuery封装一个瀑布流插件

    /*封装一个瀑布流插件*/ (function($){ $.fn.WaterFall = function(){ /*这是你初始化 调用这个方法的时候的 那个jquery选着到的dom对象 this* ...

  10. 【Oracle】搭建DG(DataGuard)

    操作系统:OEL 5.6 Oracle 版本:11.2.0.4.0 DataGuard规划说明 DATABASE_ROLE DB_NAME IPADDR Primary lgr 192.168.10. ...