5 2 3 5 2 1 4
4
3
3
-1
4
In this input, $P=(3,5,2,1,4)$ and $K=2$.
* In the $1$\-st move, the card with $3$ written on it is put on the table, face up, without stacked onto any card.
* In the $2$\-nd move, the card with $5$ written on it is put on the table, face up, without stacked onto any card.
* In the $3$\-rd move, the card with $2$ written on it is stacked, face up, onto the card with $3$ written on it.
* Now there is a pile consisting of $K=2$ face-up cards, on which $2$ and $3$ from the top are written, so these cards are eaten.
* In the $4$\-th move, the card with $1$ written on it is stacked, face up, onto the card with $5$ written on it.
* Now there is a pile consisting of $K=2$ face-up cards, on which $1$ and $5$ from the top are written, so these cards are eaten.
* In the $5$\-th move, the card with $4$ written on it is put on the table, face up, without stacked onto any card.
* The card with $4$ written on it was not eaten until the end.5 1 1 2 3 4 5
1 2 3 4 5 If $K=1$, every card is eaten immediately after put on the table within a single move.
15 3 3 14 15 9 2 6 5 13 1 7 10 11 8 12 4
9 9 9 15 15 6 -1 -1 6 -1 -1 -1 -1 6 15
{
"problem": {
"name": "Draw Your Cards",
"description": {
"content": "There is a deck consisting of $N$ face-down cards with an integer from $1$ through $N$ written on them. The integer on the $i$\\-th card from the top is $P_i$. Using this deck, you will perform $N$ mov",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc260_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a deck consisting of $N$ face-down cards with an integer from $1$ through $N$ written on them. The integer on the $i$\\-th card from the top is $P_i$.\nUsing this deck, you will perform $N$ mov...",
"is_translate": false,
"language": "English"
}
]
}