A12302 | Doors Breaking and Repairing
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move.
There are $n$ doors, the $i$ -th door initially has durability equal to $a_i$ .
During your move you can try to break one of the doors. If you choose door $i$ and its current durability is $b_i$ then you reduce its durability to $max(0, b_i - x)$ (the value $x$ is given).
During Slavik's move he tries to repair one of the doors. If he chooses door $i$ and its current durability is $b_i$ then he increases its durability to $b_i + y$ (the value $y$ is given). Slavik cannot repair doors with current durability equal to $0$ .
The game lasts $10^{100}$ turns. If some player cannot make his move then he has to skip it.
Your goal is to maximize the number of doors with durability equal to $0$ at the end of the game. You can assume that Slavik wants to minimize the number of such doors. What is the number of such doors in the end if you both play optimally?
There are $n$ doors, the $i$ -th door initially has durability equal to $a_i$ .
During your move you can try to break one of the doors. If you choose door $i$ and its current durability is $b_i$ then you reduce its durability to $max(0, b_i - x)$ (the value $x$ is given).
During Slavik's move he tries to repair one of the doors. If he chooses door $i$ and its current durability is $b_i$ then he increases its durability to $b_i + y$ (the value $y$ is given). Slavik cannot repair doors with current durability equal to $0$ .
The game lasts $10^{100}$ turns. If some player cannot make his move then he has to skip it.
Your goal is to maximize the number of doors with durability equal to $0$ at the end of the game. You can assume that Slavik wants to minimize the number of such doors. What is the number of such doors in the end if you both play optimally?
输入格式
The first line of the input contains three integers $n$ , $x$ and $y$ ( $1 \le n \le 100$ , $1 \le x, y \le 10^5$ ) — the number of doors, value $x$ and value $y$ , respectively.
The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ( $1 \le a_i \le 10^5$ ), where $a_i$ is the initial durability of the $i$ -th door.
The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ( $1 \le a_i \le 10^5$ ), where $a_i$ is the initial durability of the $i$ -th door.
输出格式
Print one integer — the number of doors with durability equal to $0$ at the end of the game, if you and Slavik both play optimally.
输入输出样例
输入 #1
6 3 2 2 3 1 3 4 2
输出 #1
6
输入 #2
5 3 3 1 2 4 2 3
输出 #2
2
输入 #3
5 5 6 1 2 6 10 3
输出 #3
2
Clarifications about the optimal strategy will be ignored.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted