시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 70 | 23 | 19 | 30.645% |
Ernesto and Penelope are playing a board game on an infinite grid. Instead of rolling dice, both of them have generated a random number, and now they have to move their pieces that number of times. A single move consists of placing the piece in an adjacent cell; moving diagonally or waiting in place are not legal moves. However, it is permitted to move the piece in the direction it just came from in the previous move.
Ernesto and Penelope are trying to move in such a way that their pieces will end up in the same cell. Is there a cell for which this is possible?
Figure M.1: Visualisation of the first sample, including possible paths for the given output.
The input consists of two lines, both containing three integers x, y (−1012 ≤ x, y ≤ 1012) and d (0 ≤ d ≤ 1012), giving for either player the pieces’ initial coordinates and the randomly generated number.
If there is a cell that both players can end up on, output its coordinates. If there are multiple valid solutions, any will be accepted. If there is no valid cell, output impossible.
1 -2 5 -3 3 8
-3 -1
0 -1000000000000 0 0 -1000000000000 0
0 -1000000000000
-5 -426 932111 83 -870 478692
impossible
ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2019 M번