| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 8 | 6 | 6 | 75.000% |
Kaz is inviting $n$ of his friends over for a party! He has currently prepared the cocktails for them (each friend has ordered a different drink), with friend $i$ having a preference for cocktail $i$.
However, Kaz is looking to pull a prank. When handing out drinks if he hands out a drink to the wrong person, he knows the following round of an 'exchange process' will occur: all partygoers who do not have their desired drinks will leave their drinks on a table. All such drinks will be shuffled and handed back in a completely random order to those still in the exchange process. Any participants who receive their desired drink will leave to enjoy the party, while those still with the wrong drink will shuffle again.
To maximize the humor of his prank, Kaz wants the exchange process to take the maximum expected number of rounds. Help Kaz find an assignment of drinks that will maximize this value.
The input consists of a single integer $n$ ($1 \leq n \leq 1\,000$) --- the number of friends invited to the party.
On the first line, output a single real number $R$ --- the maximum expected number of rounds.
On the second line, output $n$ distinct integers $p_1, p_2, \cdots, p_n$ ($1 \leq p_i \leq n$) --- the assignment of the drinks. Here, drink $p_i$ will be handed to friend $i$.
Your answer will be accepted if the output satisfies the following conditions.
2
2.0 2 1
Camp > Osijek Competitive Programming Camp > Summer 2024 > Day 5: OCPC Potluck Contest 2 K번