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

32818번 - Cleaning Robot 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB79211422.581%

문제

The road network of a city consists of a set of axis-parallel rectangles. Each rectangle road may overlap with others as shown in the figure below. The city operates an autonomous cleaning robot that is responsible to clean the entire roads every day. During cleaning, each rectangle is classified into one of three types as follows.

  1. Uncleared (UC): A rectangle that the cleaning robot has never visited.
  2. Partially cleared (PC): A rectangle that has been cleaned partially.
  3. All cleared (AC): A rectangle that has been completely cleaned.

The cleaning robot works according to the following routing algorithm.

  • The robot moves in a clockwise direction while cleaning each rectangle.
  • If the robot encounters a road of a new UC rectangle during the cleaning of a rectangle, it will turn at the crossing point and move towards the UC rectangle.
  • When a rectangle is completely cleaned as the robot reaches a point $(x, y)$ and another PC rectangle is encountered at $(x, y),ドル the robot resumes cleaning the PC rectangle at that same point $(x, y)$.
  • If the robot returns to the starting point, it will stay at that point afterwards.
  • It takes the robot one second to move a unit distance along edges, and takes two seconds in changing direction at a crossing point or corner.

Let us explain the routing algorithm with the following example. The example road network consists of four rectangles $\{R_1, R_2, R_3, R_4\}$ where the starting point is $s$ of $R_1$.

The orange lines in the following figure depict the trajectory of the cleaning robot starting from $s$ of $R_1$.

Given information about $n$ rectangles, we want to know the exact locations of the robot for the five query points $t_i$ (1ドル ≤ i ≤ 5$) in time. Note that the starting point is designated to the upper left corner of the rectangle $R_1$.

입력

Your program is to read from standard input. The input starts 1ドル ≤ i ≤ 5$ with a line containing one integer, $n$ (1ドル ≤ n ≤ 50$), where $n$ is the number of rectangles $R_i$. The second line gives the five query points $t_i$ (1ドル ≤ i ≤5$) in time where 1ドル ≤ t_i ≤ 100,000円$. The $i$-th line of following $n$ lines gives four integers $x_l,ドル $y_l,ドル $x_u,ドル $y_u$ for $R_i$ where $(x_l , y_l)$ is the lower left corner and $(x_u, y_u)$ is the upper right corner where 1ドル ≤ x_l < x_u ≤1,000円,ドル and 1ドル ≤ y_l < y_u ≤ 1,000円$. Note that the intersection points between rectangles are all in the middle of edges, not at corner points, and there are no edge overlaps among rectangles, so the configurations below are not given in this problem. Also note that rectangles are not necessarily all connected into one component.

출력

Your program is to write to standard output. Print exactly five lines. The line should contain two integers $x_i,ドル $y_i$ where $(x_i, y_i)$ is the location of the cleaning robot at time $t_i$ (1ドル ≤ i ≤ 5$).

The following shows sample input and output for three test cases. Note that at time $t = 0,ドル the robot is ready to start at the starting point.

제한

예제 입력 1

4
1234 10000 700 3000 5000
100 500 300 800
100 100 900 400
150 30 190 550
230 350 700 700

예제 출력 1

900 376
100 800
696 700
190 452
230 476

예제 입력 2

7
9001 8002 7003 6004 5005
200 100 300 800
350 100 500 800
600 100 700 800
100 600 800 700
100 400 800 500
100 200 800 300
900 200 1000 700

예제 출력 2

263 100
154 600
551 700
500 142
235 400

예제 입력 3

5
1298 5574 3332 1794 7141
400 150 650 700
100 100 750 500
200 400 850 600
500 300 1000 650
150 150 350 350

예제 출력 3

750 262
500 540
812 600
418 100
400 699

힌트

출처

ICPC > Regionals > Asia Pacific > Korea > Nationwide Internet Competition > Seoul Nationalwide Internet Competition 2024 A번

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

출처

대학교 대회

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

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