| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 32 | 19 | 19 | 73.077% |
You are knitting a scarf in a striped pattern, having made strong progress on the first few stripes. You have multiple colours available to continue creating the pattern and would very much like that no colour appears too often -- more specifically, that the colour appearing most often still appears as few times as possible.
Figure K.1: A knitted solution to sample input 1. No colour is used more than twice, nor is any colour repeated within 3 consecutive stripes.
Please extend the given design to fashion a nice scarf.
The colours of the stripes are represented as integers in $[1{\ldots}k]$.
Output any stripe pattern starting with $s_{1 \ldots m}$ that does not repeat any of the colours too soon and uses the most-frequent colour as few times as possible.
If it is not possible to create a scarf from the parameters, output impossible instead.
10 6 3 4 4 1 6 4
4 1 6 4 1 5 2 3 6 5
5 2 3 2 1 2
impossible
2 2 3 1 2
2 1
10 26 5 4 8 3 16 3
impossible
ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2024 K번