結果

問題 No.123 カードシャッフル
ユーザー togatogatogatoga
提出日時 2015-09-03 09:31:05
言語 Python2
(2.7.18)
結果
AC  
実行時間 655 ms / 5,000 ms
コード長 259 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 12,248 KB
最終ジャッジ日時 2023-09-26 02:32:17
合計ジャッジ時間 2,692 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,812 KB
testcase_01 AC 12 ms
5,928 KB
testcase_02 AC 11 ms
5,924 KB
testcase_03 AC 11 ms
5,980 KB
testcase_04 AC 12 ms
5,868 KB
testcase_05 AC 12 ms
5,924 KB
testcase_06 AC 11 ms
5,932 KB
testcase_07 AC 11 ms
5,816 KB
testcase_08 AC 11 ms
6,064 KB
testcase_09 AC 10 ms
6,064 KB
testcase_10 AC 109 ms
7,240 KB
testcase_11 AC 655 ms
12,248 KB
testcase_12 AC 388 ms
11,296 KB
testcase_13 AC 389 ms
11,072 KB
権限があれば一括ダウンロードができます

ソースコード

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