Logo
(追記) (追記ここまで)

32424번 - Flipping Container 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB5012726.923%

문제

A large, cuboid-shaped shipping container has been delivered to your shipping yard. Before you can open it up, you first need to move the container to a different location in your yard.

Normally, you would simply lift up the container using a crane and drop it in its target location. Unfortunately, your crane is broken, and the only way for you to move the container is by carefully flipping the container over one of its bottom four edges, resulting in a 90ドル$-degree rotation around the axis running along that edge. Your hope is that you will eventually be able to reach the target location by repeating this action enough times.

Just how many times will you need to perform this flip operation to get the container to the right spot? Note that the orientation of the container changes as you move it across the yard, but in the end it needs to be in the same orientation as at the start. Two orientations are considered the same when they have the same length along each of the three axes of the coordinate system. The three side lengths of the container are distinct.

입력

The first line contains three distinct integers $a,ドル $b$ and $c$ (1ドル ≤ a, b, c ≤ 1,円 000$), the dimensions of the container in meters. In the initial orientation of the container, the sides of length $a$ run in east-west direction, the sides of length $b$ run in north-south direction, and the sides of length $c$ run in up-down direction.

The second line contains two integers $x$ and $$ ($-10^{18} ≤ x, y ≤ 10^{18}$) giving the target location of the container. The container needs to be moved by $x$ meters in the east-west direction and by $y$ meters in the north-south direction (positive numbers indicate moving to the east/north, negative numbers indicate west/south).

출력

Output the least number of times the container needs to be flipped to reach its target location. If it is not possible to reach the target location, output impossible.

제한

예제 입력 1

3 4 5
8 0

예제 출력 1

2

예제 입력 2

3 4 5
-8 9

예제 출력 2

4

예제 입력 3

3 4 5
123 45

예제 출력 3

40

예제 입력 4

20 10 30
13 37

예제 출력 4

impossible

힌트

출처

ICPC > World Finals > ICPC World Finals 2024 E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /