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

【题意】



给出n个人的比赛信息;

5道题

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

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

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

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

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

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

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

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

【题解】



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

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

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

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



【Number Of WA】



1



【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x) typedef pair<int,int> pii;
typedef pair<LL,LL> pll; const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 120+20; int n,solves[6],a[N][6],tsolves[6]; int cal(int time,int ac,int tot)
{
if (time==-1) return 0;
if (2*ac>tot) return 2*(250-time);
if (4*ac>tot) return 4*(250-time);
if (8*ac>tot) return 6*(250-time);
if (16*ac>tot) return 8*(250-time);
if (32*ac>tot) return 10*(250-time);
return 12*(250-time);
} bool check(int k)//k是枚举的添加的cheater参赛选手个数
{
rep1(i,1,5) tsolves[i] = solves[i];
rep1(i,1,5)
{
if (a[1][i]!=-1)//需要先解决这个问题,新注册的账号才能提交正确的
{
if (a[2][i]==-1)
{
//keep the ratio
}
else
if (a[1][i]>a[2][i])//如果用的时间比较长,让这个题的AC率
//提高
{
tsolves[i]+=k;
}
}
}
int l = 0,r = 0;
rep1(i,1,5)
{
l+=cal(a[1][i],tsolves[i],n+k);
r+=cal(a[2][i],tsolves[i],n+k);
}
return l>r;
} int main()
{
//freopen("D:\\rush.txt","r",stdin);
ios::sync_with_stdio(false),cin.tie(0);//scanf,puts,printf not use
cin >> n;
rep1(i,1,n)
{
rep1(j,1,5)
{
cin >> a[i][j];
if (a[i][j]!=-1)
solves[j]++;
}
}
rep1(i,0,n*33)
{
if (check(i))
{
cout <<i <<endl;
return 0;
}
}
cout <<-1<<endl;
return 0;
}

【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. javascript学习笔记(一)-廖雪峰教程

    一. 基础 1.for in,for of和forEach 遍历的是对象的属性,因为数组也是对象,其内部的元素的索引就是其属性值.用该方式遍历数组就是获取了数组中的每一个元素的索引值(从0開始). 而 ...

  2. sikuli类、函数使用参考java doc

    sikuli类.函数使用可以参考java  dochttp://doc.sikuli.org/javadoc/ http://stackoverflow.com/questions/9568612/s ...

  3. DevExpress14.1.2 xe XE6 高速安装

    之前在在网上下载的DevExpress14.1.2 xe-XE6都是一个个包文件.须要一个个去查找编译安装,并且须要有一定的顺序要求. 所下面载了好久了都没有安装. 近期在网上找了个旧版的安装方法.以 ...

  4. HDU3535 AreYouBusy 混合背包

    题目大意 给出几组物品的体积和价值,每组分为三种:0.组内物品至少选一个:1.组内物品最多选一个:2.组内物品任意选.给出背包容量,求所能得到的最大价值. 注意 仔细审题,把样例好好看完了再答题,否则 ...

  5. Nginx实战系列之功能篇----后端节点健康检查

    目前,nginx对后端节点健康检查的方式主要有3种,这里列出:   1.ngx_http_proxy_module 模块和ngx_http_upstream_module模块(自带)    官网地址: ...

  6. Hadoop MapReduce编程 API入门系列之分区和合并(十四)

    不多说,直接上代码. 代码 package zhouls.bigdata.myMapReduce.Star; import java.io.IOException; import org.apache ...

  7. NSLayoutConstraint的使用

    *一切皆代码*- -- #继承关系框架|类|类:-:|:-:|:-:UIKit|NSLayoutConstraint|--|-|- #应用场景UI界面的搭建一般会占用项目开发相当一部分的时间.涉及到控 ...

  8. js编写时间选择框

    效果图: 代码: 新建js:WdatePicker.js /* * My97 DatePicker 4.72 Release * License: http://www.my97.net/dp/lic ...

  9. mysql和eclipse连接jdbc驱动配置

    环境Windows10 eclipse 64位 MySQL 一:资料准备 (MySQL,eclipse下载安装不在赘述) 配置好MySQL环境后 下载jdbc地址http://dev.mysql.co ...

  10. hdu 2444 The Accomodation of Students 判断是否构成二分图 + 最大匹配

    此题就是求最大匹配.不过需要判断是否构成二分图.判断的方法是人选一点标记为红色(0),与它相邻的点标记为黑色(1),产生矛盾就无法构成二分图.声明一个vis[],初始化为-1.通过深搜,相邻的点不满足 ...