| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 74 | 45 | 30 | 54.545% |
We consider a set of integers $S$ to be anti-closed if there do not exist elements $x$, $y$ and $z$ in $S$ where $x+y=z$ ($x$, $y$ and $z$ do not necessarily have to be distinct).
For example:
You are given an array $a$ of $n$ distinct integers. Partition it into at most $60$ anti-closed subsequences. Formally, find an array $b$ of size $n$ such that
It can be shown that a solution always exists.
The first line of the input contains a single integer $n$ ($1 \le n \le 10^4$) --- the size of the array $a$.
The next line of the input contains $n$ distinct integers $a_1, a_2 \cdots a_n$ ($1 \le a_i \le 10^{18}$) --- the elements of the array $a$.
Output $n$ integers $b_1, b_2, \cdots b_n$ ($1 \le b_i \le 60$), representing the partition of $a$, as described above.
If there are multiple solutions, print any.
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 2 2 1 3 1 3 3 2 2 4 4 4 2 1
3 250000000000000000 500000000000000000 1000000000000000000
1 2 3
For the first test case, the input array is partitioned into these subsequences:
We can show that each of these sets is anti-closed.