A9785 | Board Game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Polycarp and Vasiliy love simple logical games. Today they play a game with infinite chessboard and one pawn for each player. Polycarp and Vasiliy move in turns, Polycarp starts. In each turn Polycarp can move his pawn from cell $(x,y)$ to $(x-1,y)$ or $(x,y-1)$ . Vasiliy can move his pawn from $(x,y)$ to one of cells: $(x-1,y),(x-1,y-1)$ and $(x,y-1)$ . Both players are also allowed to skip move.
There are some additional restrictions — a player is forbidden to move his pawn to a cell with negative $x$ -coordinate or $y$ -coordinate or to the cell containing opponent's pawn The winner is the first person to reach cell $(0,0)$ .
You are given the starting coordinates of both pawns. Determine who will win if both of them play optimally well.
There are some additional restrictions — a player is forbidden to move his pawn to a cell with negative $x$ -coordinate or $y$ -coordinate or to the cell containing opponent's pawn The winner is the first person to reach cell $(0,0)$ .
You are given the starting coordinates of both pawns. Determine who will win if both of them play optimally well.
输入格式
The first line contains four integers: $x_{p},y_{p},x_{v},y_{v}$ ( $0<=x_{p},y_{p},x_{v},y_{v}<=10^{5})$ — Polycarp's and Vasiliy's starting coordinates.
It is guaranteed that in the beginning the pawns are in different cells and none of them is in the cell $(0,0)$ .
It is guaranteed that in the beginning the pawns are in different cells and none of them is in the cell $(0,0)$ .
输出格式
Output the name of the winner: "Polycarp" or "Vasiliy".
输入输出样例
输入 #1
2 1 2 2
输出 #1
Polycarp
输入 #2
4 7 7 4
输出 #2
Vasiliy
In the first sample test Polycarp starts in $(2,1)$ and will move to $(1,1)$ in the first turn. No matter what his opponent is doing, in the second turn Polycarp can move to $(1,0)$ and finally to $(0,0)$ in the third turn.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted