結果

問題 No.123 カードシャッフル
コンテスト
ユーザー togatoga
提出日時 2015-09-03 09:31:22
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 72 ms / 5,000 ms
コード長 259 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,338 ms
コンパイル使用メモリ 80,604 KB
実行使用メモリ 181,952 KB
最終ジャッジ日時 2026-04-02 12:42:07
合計ジャッジ時間 4,066 ms
ジャッジサーバーID
(参考情報)
judge4_1 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,M = map(int, raw_input().split())
A = map(int, raw_input().split())
pos = [0] * (N + 1)
for i in range(1, N + 1):
    pos[i] = i

for x in A:
    tmp = pos[x]
    for y in reversed(range(2, x + 1)):
        pos[y] = pos[y - 1]
    pos[1] = tmp
print pos[1]
0