CF533C.Board Game
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
波利卡尔普和瓦西里喜欢简单的逻辑游戏。今天,他们在一个无限大的棋盘上进行一局游戏,每位玩家各持一个兵(pawn)。波利卡尔普和瓦西里轮流移动,波利卡尔普先手。在每一轮中,波利卡尔普可以将自己的兵从格子 (x,y) 移动到 (x−1,y) 或 (x,y−1);而瓦西里可以将自己的兵从 (x,y) 移动到以下三个格子之一:(x−1,y)、(x−1,y−1) 或 (x,y−1)。两位玩家也都被允许跳过本轮移动。
此外还有一些额外限制:玩家不得将自己的兵移动到横坐标 x 或纵坐标 y 为负的格子,也不得移动到对方兵所在的格子。首先到达格子 (0,0) 的人获胜。
已知双方兵的初始坐标,请判断:若双方均以最优策略进行游戏,谁将获胜?
输入格式
The first line contains four integers: x__p, y__p, x__v, y__v (0 ≤ x__p, y__p, x__v, y__v ≤ 105) — 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).
第一行包含四个整数:xp, yp, xv, yv(0≤xp, yp, xv, yv≤105)—— 分别为 Polycarp 和 Vasiliy 的起始坐标。
保证初始时两个兵位于不同的格子,且均不在 (0, 0) 格。
输出格式
Output the name of the winner: "Polycarp" or "Vasiliy".
输出获胜者的名字:“Polycarp”或“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.
在第一个样例测试中,Polycarp 起始于 (2,1),并在第一回合移动到 (1,1)。无论他的对手如何行动,在第二回合 Polycarp 都可以移动到 (1,0),并最终在第三回合到达 (0,0)。
输入解题思路,AI测评打分。不知道怎么写?