{"problem":{"name":"Add and Swap","description":{"content":"You are given integers $N$, $K$, and a sequence $A = (A_1, \\ldots, A_N)$ of length $N$. Determine whether it is possible to make $A$ non-decreasing by performing the following operation at most $50000","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc187_a"},"statements":[{"statement_type":"Markdown","content":"You are given integers $N$, $K$, and a sequence $A = (A_1, \\ldots, A_N)$ of length $N$.\nDetermine whether it is possible to make $A$ non-decreasing by performing the following operation at most $500000$ times, and if possible, provide one sequence of operations to do so.\n\n*   Choose an integer $i$ between $1$ and $N-1$, inclusive. Simultaneously replace $A_i$ with $A_{i+1} + K$, and $A_{i+1}$ with $A_i$.\n\n## Constraints\n\n*   All input numbers are integers.\n*   $2 \\leq N \\leq 50$\n*   $1 \\leq K \\leq 50$\n*   $1 \\leq A_i \\leq 50$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $K$\n$A_1$ $\\ldots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc187_a","tags":[],"sample_group":[["3 2\n3 6 4","Yes\n1\n2\n\nLet us perform the operation with $i=2$. This simultaneously replaces $A_2$ with $A_3 + 2 = 6$, and $A_3$ with $A_2 = 6$, making $A = (3,6,6)$.\nNow $A$ is non-decreasing, so this output satisfies the conditions."],["3 3\n1 5 8","Yes\n2\n2 2\n\nIt is not necessary to minimize the number of operations."]],"created_at":"2026-03-03 11:01:14"}}