Codeforces Round 245 (Div. 2)
A
Points and Segments (easy)
Codeforces
1600
原题
←B →
翻译中…

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 points and $*m*$ segments on the $*OX*$ axis. He can draw each point with either red or blue. The drawing is good if and only if the following requirement is met: for each segment $[*l*_{*i*}, *r*_{*i*}]$ consider all the red points belong to it ($*r*_{*i*}$ points), and all the blue points belong to it ($*b*_{*i*}$ points); each segment $*i*$ should satisfy the inequality $|*r*_{*i*} - *b*_{*i*}| ≤ 1$.

翻译中…

Iahub thinks that point $*x*$ belongs to segment $[*l*, *r*]$, if inequality $*l* ≤ *x* ≤ *r*$ holds.

翻译中…

Iahub gives to you all coordinates of points and segments. Please, help him to find any good drawing.

翻译中…

Input

翻译中…

The first line of input contains two integers: $*n*$ ($1 ≤ *n* ≤ 100$) and $*m*$ ($1 ≤ *m* ≤ 100$). The next line contains $*n*$ space-separated integers $*x*_{1}, *x*_{2}, ..., *x*_{*n*}$ ($0 ≤ *x*_{*i*} ≤ 100$) — the coordinates of the points. The following $*m*$ lines contain the descriptions of the $*m*$ segments. Each line contains two integers $*l*_{*i*}$ and $*r*_{*i*}$ ($0 ≤ *l*_{*i*} ≤ *r*_{*i*} ≤ 100$) — the borders of the $*i*$-th segment.

翻译中…

It's guaranteed that all the points 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 point (0 is red, and 1 is blue).

翻译中…

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

翻译中…

样例

Input #1
3 3
3 7 14
1 5
6 10
11 15
Output #1
0 0 0
InputCopy OutputCopy
Input #2
3 4
1 2 3
1 2
2 3
5 6
2 2
Output #2
1 0 1
InputCopy OutputCopy
题目信息
题号
430A
时间限制
1 s
内存限制
256 MB
标签
构造
排序

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