| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 5 초 | 2048 MB | 3 | 3 | 3 | 100.000% |
Nearly a hundred people are involved in making NWERC possible -- organizers, volunteers, jury, the systems and streaming team, and last but not least, the DOMjudge team, who are responsible for the judging system. They come to every NWERC and always have a lot of fun while being there!
The DOMjudge team members like to share a flat during NWERC, but often, there are not enough keys for everybody to have their own. This can make logistics a bit tricky: some people like to head out early for breakfast, others stay out late at the Christmas market, and some may return to the flat for a quick afternoon nap. If someone returns to the flat while another person is already in the flat, they can simply ring the bell and will be let in. However, if someone returns while the flat is empty, they will need to have a key with them.
Given the times when each person is out on a trip, determine when each person should take a key with them so that everyone can get into the flat without being (temporarily) locked out.
Figure J.1: Illustration of Sample Input 1, with 3ドル$ DOMjudge team members, 2ドル$ keys, and a total of 5 trips. Trips where the person brings a key are shown in bold. Twice, a person comes home to an empty house and has to use their key to open the door.
The input consists of:
At any time, at most one person arrives or leaves.
It is guaranteed that for each person, the trips they make do not touch or overlap.
If it is possible to distribute keys such that no one is locked out, output a string of $q$ characters, where each character is either '0' or '1'. The $i$th character of the string is '1' if the person going on the $i$th trip (in input order) should take a key with them and '0' if they should not take a key with them. Otherwise, output "impossible".
If there are multiple valid solutions, you may output any one of them.
3 2 5 3 0 9 1 2 18 2 4 7 3 12 22 2 14 20
01110
2 1 2 1 2 4 2 1 3
01
2 1 3 1 1 5 2 2 3 2 4 6
impossible
ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2025 J번