結果

問題 No.123 カードシャッフル
ユーザー togatoga
提出日時 2015-09-03 09:31:22
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 259 bytes
コンパイル時間 1,435 ms
コンパイル使用メモリ 76,544 KB
実行使用メモリ 85,632 KB
最終ジャッジ日時 2024-07-18 21:52:57
合計ジャッジ時間 3,338 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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