{"problem":{"name":"1D Pawn","description":{"content":"There are $N$ squares, indexed Square $1$, Square $2$, …, Square $N$, arranged in a row from left to right.   Also, there are $K$ pieces. The $i$\\-th piece from the left is initially placed on Square ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc257_b"},"statements":[{"statement_type":"Markdown","content":"There are $N$ squares, indexed Square $1$, Square $2$, …, Square $N$, arranged in a row from left to right.  \nAlso, there are $K$ pieces. The $i$\\-th piece from the left is initially placed on Square $A_i$.  \nNow, we will perform $Q$ operations against them. The $i$\\-th operation is as follows:\n\n*   If the $L_i$\\-th piece from the left is on its rightmost square, do nothing.\n*   Otherwise, move the $L_i$\\-th piece from the left one square right if there is no piece on the next square on the right; if there is, do nothing.\n\nPrint the index of the square on which the $i$\\-th piece from the left is after the $Q$ operations have ended, for each $i=1,2,\\ldots,K$.\n\n## Constraints\n\n*   $1\\leq K\\leq N\\leq 200$\n*   $1\\leq A_1<A_2<\\cdots<A_K\\leq N$\n*   $1\\leq Q\\leq 1000$\n*   $1\\leq L_i\\leq K$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $K$ $Q$\n$A_1$ $A_2$ $\\ldots$ $A_K$\n$L_1$ $L_2$ $\\ldots$ $L_Q$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc257_b","tags":[],"sample_group":[["5 3 5\n1 3 4\n3 3 1 1 2","2 4 5\n\nAt first, the pieces are on Squares $1$, $3$, and $4$. The operations are performed against them as follows:\n\n*   The $3$\\-rd piece from the left is on Square $4$. This is not the rightmost square, and the next square on the right does not contain a piece, so move the $3$\\-rd piece from the left to Square $5$. Now, the pieces are on Squares $1$, $3$, and $5$.\n*   The $3$\\-rd piece from the left is on Square $5$. This is the rightmost square, so do nothing. The pieces are still on Squares $1$, $3$, and $5$.\n*   The $1$\\-st piece from the left is on Square $1$. This is not the rightmost square, and the next square on the right does not contain a piece, so move the $1$\\-st piece from the left to Square $2$. Now, the pieces are on Squares $2$, $3$, and $5$.\n*   The $1$\\-st piece from the left is on Square $2$. This is not the rightmost square, but the next square on the right (Square $3$) contains a piece, so do nothing. The pieces are still on Squares $2$, $3$, and $5$.\n*   The $2$\\-nd piece from the left is on Square $3$. This is not the rightmost square, and the next square on the right does not contain a piece, so move the $2$\\-nd piece from the left to Square $4$; Now, the pieces are still on Squares $2$, $4$, and $5$.\n\nThus, after the $Q$ operations have ended, the pieces are on Squares $2$, $4$, and $5$, so $2$, $4$, and $5$ should be printed in this order, with spaces in between."],["2 2 2\n1 2\n1 2","1 2"],["10 6 9\n1 3 5 7 8 9\n1 2 3 4 5 6 5 6 2","2 5 6 7 9 10"]],"created_at":"2026-03-03 11:01:14"}}