Towers | 프로그래밍의 벗 PivotOJ
PivotOJ

Towers

시간 제한: 2000ms메모리 제한: 1024MB출처: NOI 2022BOJ 27290

문제

Benson the Rabbit likes towers. There are NN cities numbered 11 to NN, and city ii is located at a point with integer coordinates (Xi,Yi)(X_i , Y_i). No two cities are located at the same point. Benson wants to build towers in some of these cities such that the following conditions are satisfied:

  • For any aa, there are at most two towers with xx-coordinate equal to aa.
  • For any bb, there are at most two towers with yy-coordinate equal to bb.
  • Each of the NN cities either has a tower built, or lies on the line segment between two towers with the same xx-coordinate or the same yy-coordinate. More formally, for a city located at (x,y)(x, y), if there is no tower in that city, then there are two towers at coordinates (x,c)(x, c), (x,d)(x, d) with c ≤ y ≤ d, or two towers at coordinates (e,y)(e, y), (f,y)(f, y) with e ≤ x ≤ f.

Benson knows that it is always possible to build towers satisfying these conditions, but does not know how he should do so. Help Benson determine where he should build the towers.

입력

Your program must read from standard input.

The first line of the input contains one integer, NN, the number of cities.

In the next NN lines, the iith line contains two integers XiX_i, YiY_i, which means city ii is located at the point (Xi,Yi)(X_i , Y_i).

출력

Your program must print to standard output.

Output one line containing a string of NN characters A1A2ANA_1A_2 \cdots A_N. AiA_i should be 11 if Benson should build a tower in city ii, and 00 otherwise. The towers built should satisfy all the conditions.

If there are several solutions your program can output any one of them.

예제

예제 1

입력
3
1 1
1 6
1 5
출력
110

예제 2

입력
6
1 1
1 2
2 1
2 2
3 1
3 2
출력
110011

예제 3

입력
8
1 13
2 13
7 27
7 13
7 2
2 27
7 4
4 13
출력
10101101
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.