아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Forest for the Trees

시간 제한2초메모리 제한1024 MB

요약
최대 5000개의 나무 좌표와 최대 1000개의 상대 센서 값이 주어질 때 로봇의 지도상 위치를 찾고, 불가능하거나 여러 후보가 있으면 각각 Impossible, Ambiguous를 출력한다.
난이도

보통10점 중 7점

유형
해시맵, 기하, 완전 탐색
정답자
아직 제출이 없습니다

문제

You have sent a robot out into the forest, and it has gotten lost. It has a sensor that will detect all the trees around itself regardless of any occlusions, but unfortunately in this forest, all trees look alike. You do have a map of all trees in the forest, represented as (x,y)(x,y) points. Conveniently, since this used to be a tree farm, all trees are at integer coordinates, though not all coordinates are occupied. The robot's sensor tells you the xx and yy distance to each tree within range, relative to the front of the robot. However, the robot is heading in an unknown direction relative to the map, so each sensor reading is given as a tuple of (distance to the right of the robot, distance forward of the robot) and either value can be negative since the robot can sense in all directions. Helpfully, the robot will always place itself at integer coordinates and aligned to the positive or negative xx or yy axis, and will never be at the same location as a tree. Can you find out where the robot is?

입력

The first line of input contains three integers: n_tn\_t, the number of trees in the forest, n_sn\_s, the number of trees sensed by the robot, and r_maxr\_{max}, the maximum Manhattan distance (sum of xx and yy distances) of any sensor reading. The next n_tn\_t lines each contain two integers representing the (x,y)(x,y) locations of all the trees relative to a global coordinate system. The final n_sn\_s lines each contain two integers. The first integer in the ithi^{th} sensor reading, s_i,xs\_{i,x}, represents the distance to the tree along the axis perpendicular to the robot's heading and the second integer s_i,ys\_{i,y} represents the distance along the axis parallel to the robot's heading. You can assume that ∣s_i,x∣+∣s_i,y∣≤r_max|s\_{i,x}|+|s\_{i,y}| \leq r\_{max} for all ii. You may also assume 0<n_t≤50000 < n\_t \leq 5000, 0<n_s≤10000 < n\_s \leq 1000, 0<r_max≤10000 < r\_{max} \leq 1000, and all tree locations have xx and yy coordinates −100,000≤x,y≤100,000-100,000 \leq x,y \leq 100,000.

출력

Print one of the following: the x,yx,y location of the robot, printed as two integers separated by a space; "Impossible" if there is no location in the map that could produce the given sensor values, or "Ambiguous" if two or more distinct locations and/or orientations could produce the given sensor values.

예제1

  1. 예제 1

    입력
    4 4 100
    1 1
    2 2
    2 1
    3 3
    0 1
    0 2
    -1 2
    -2 3
    
    예상 출력
    0 1