結果

問題 No.123 カードシャッフル
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-09-07 16:53:39
言語 Python2
(2.7.18)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 326 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 6,672 KB
実行使用メモリ 12,552 KB
最終ジャッジ日時 2023-09-26 10:00:25
合計ジャッジ時間 1,893 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
6,292 KB
testcase_01 AC 13 ms
6,288 KB
testcase_02 AC 13 ms
6,428 KB
testcase_03 AC 13 ms
6,364 KB
testcase_04 AC 13 ms
6,300 KB
testcase_05 AC 13 ms
6,204 KB
testcase_06 AC 13 ms
6,432 KB
testcase_07 AC 13 ms
6,272 KB
testcase_08 AC 13 ms
6,432 KB
testcase_09 AC 13 ms
6,288 KB
testcase_10 AC 128 ms
7,672 KB
testcase_11 AC 134 ms
12,552 KB
testcase_12 AC 141 ms
11,784 KB
testcase_13 AC 140 ms
11,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from collections import deque
def remove_nth(d, n):
    d.rotate(-n)
    res = d.popleft()
    d.rotate(n)
    return res

n, _ = map(int, raw_input().split())
stk = deque(xrange(1, n+1))
a = map(lambda x: int(x)-1, raw_input().split())
for i in a:
    stk.appendleft(remove_nth(stk, i))
print stk.popleft()
0