Codeforces Round 245 (Div. 1)
E
Points and Segments
Codeforces
3000
原题
← D→
翻译中…

Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.

翻译中…

Iahub wants to draw $*n*$ distinct segments $[*l*_{*i*}, *r*_{*i*}]$ on the $*OX*$ axis. He can draw each segment with either red or blue. The drawing is good if and only if the following requirement is met: for each point $*x*$ of the $*OX*$ axis consider all the segments that contains point $*x*$; suppose, that $*r*_{*x*}$ red segments and $*b*_{*x*}$ blue segments contain point $*x*$; for each point $*x*$ inequality $|*r*_{*x*} - *b*_{*x*}| ≤ 1$ must be satisfied.

翻译中…

A segment $[*l*, *r*]$ contains a point $*x*$ if and only if $*l* ≤ *x* ≤ *r*$.

翻译中…

Iahub gives you the starting and ending points of all the segments. You have to find any good drawing for him.

翻译中…

Input

翻译中…

The first line of input contains integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$) — the number of segments. The $*i*$-th of the next $*n*$ lines contains two integers $*l*_{*i*}$ and $*r*_{*i*}$ ($0 ≤ *l*_{*i*} ≤ *r*_{*i*} ≤ 10^{9}$) — the borders of the $*i*$-th segment.

翻译中…

It's guaranteed that all the segments are distinct.

翻译中…

Output

翻译中…

If there is no good drawing for a given test, output a single integer -1. Otherwise output $*n*$ integers; each integer must be 0 or 1. The $*i*$-th number denotes the color of the $*i*$-th segment (0 is red and 1 is blue).

翻译中…

If there are multiple good drawings you can output any of them.

翻译中…

样例

Input #1
2
0 2
2 3
Output #1
0 1
InputCopy OutputCopy
Input #2
6
1 5
1 3
3 5
2 10
11 11
12 12
Output #2
0 1 0 1 0 0
InputCopy OutputCopy
题目信息
题号
429E
时间限制
1 s
内存限制
256 MB
标签
图论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。