A10463 | To Hack or not to Hack
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Consider a regular Codeforces round consisting of three problems that uses dynamic scoring.
You are given an almost final scoreboard. For each participant (including yourself), the time of the accepted submission for each of the problems is given. Also, for each solution you already know whether you are able to hack it or not. The only changes in the scoreboard that will happen before the end of the round are your challenges.
What is the best place you may take at the end?
More formally, $n$ people are participating (including yourself). For any problem, if it was solved by exactly $k$ people at the end of the round, the maximum score for this problem is defined as:
1. If $n<2k<=2n$ , then the maximum possible score is $500$ ;
2. If $n<4k<=2n$ , then the maximum possible score is $1000$ ;
3. If $n<8k<=2n$ , then the maximum possible score is $1500$ ;
4. If $n<16k<=2n$ , then the maximum possible score is $2000$ ;
5. If $n<32k<=2n$ , then the maximum possible score is $2500$ ;
6. If $32k<=n$ , then the maximum possible score is $3000$ .
Let the maximum possible score for some problem be equal to $s$ . Then a contestant who didn't manage to get it accepted (or his solution was hacked) earns $0$ points for this problem. If he got the the solution accepted $t$ minutes after the beginning of the round (and his solution wasn't hacked), he earns  points for this problem.
The overall score of a participant is equal to the sum of points he earns for each problem plus $100$ points for each successful hack (only you make hacks).
The resulting place you get is equal to one plus the number of participants who's overall score is strictly greater than yours.
You are given an almost final scoreboard. For each participant (including yourself), the time of the accepted submission for each of the problems is given. Also, for each solution you already know whether you are able to hack it or not. The only changes in the scoreboard that will happen before the end of the round are your challenges.
What is the best place you may take at the end?
More formally, $n$ people are participating (including yourself). For any problem, if it was solved by exactly $k$ people at the end of the round, the maximum score for this problem is defined as:
1. If $n<2k<=2n$ , then the maximum possible score is $500$ ;
2. If $n<4k<=2n$ , then the maximum possible score is $1000$ ;
3. If $n<8k<=2n$ , then the maximum possible score is $1500$ ;
4. If $n<16k<=2n$ , then the maximum possible score is $2000$ ;
5. If $n<32k<=2n$ , then the maximum possible score is $2500$ ;
6. If $32k<=n$ , then the maximum possible score is $3000$ .
Let the maximum possible score for some problem be equal to $s$ . Then a contestant who didn't manage to get it accepted (or his solution was hacked) earns $0$ points for this problem. If he got the the solution accepted $t$ minutes after the beginning of the round (and his solution wasn't hacked), he earns  points for this problem.
The overall score of a participant is equal to the sum of points he earns for each problem plus $100$ points for each successful hack (only you make hacks).
The resulting place you get is equal to one plus the number of participants who's overall score is strictly greater than yours.
输入格式
The first line of the input contains a single integer $n$ ( $1<=n<=5000$ ) — the number of participants. You are the participant number $1$ .
Each of the following $n$ lines contains three integers $a_{i}$ , $b_{i}$ and $c_{i}$ . Here $a_{i}=0$ means that the participant number $i$ didn't manage to accept first problem. If $1<=a_{i}<=120$ , then the participant number $i$ got the first problem accepted $a_{i}$ minutes after the start of the contest and you cannot hack this solution. Finally, $-120<=a_{i}<=-1$ means that the participant number $i$ got the first problem accepted $-a_{i}$ minutes after the start of the contest and you can hack this solution. Similarly, $b_{i}$ and $c_{i}$ provide the information regarding second and third problems in the same format.
It's guaranteed that integers $a_{1}$ , $b_{1}$ and $c_{1}$ are non-negative.
Each of the following $n$ lines contains three integers $a_{i}$ , $b_{i}$ and $c_{i}$ . Here $a_{i}=0$ means that the participant number $i$ didn't manage to accept first problem. If $1<=a_{i}<=120$ , then the participant number $i$ got the first problem accepted $a_{i}$ minutes after the start of the contest and you cannot hack this solution. Finally, $-120<=a_{i}<=-1$ means that the participant number $i$ got the first problem accepted $-a_{i}$ minutes after the start of the contest and you can hack this solution. Similarly, $b_{i}$ and $c_{i}$ provide the information regarding second and third problems in the same format.
It's guaranteed that integers $a_{1}$ , $b_{1}$ and $c_{1}$ are non-negative.
输出格式
Print the only integer — the best place you can take at the end of the round.
输入输出样例
输入 #1
4 120 120 1 61 61 120 -61 61 120 0 0 0
输出 #1
1
输入 #2
4 0 0 119 -3 -17 -42 0 7 0 51 0 0
输出 #2
2
Consider the first sample. If you do not hack any solutions, you will win the contest (scoreboard to the left). However, if you hack the solution of the first problem of the third participant (the only one you can hack), the maximum score for the first problem will change and you will finish second (scoreboard to the right).


C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted