結果

問題 No.1021 Children in Classrooms
ユーザー chocoruskchocorusk
提出日時 2020-04-07 17:33:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 31,976 KB
最終ジャッジ日時 2023-09-22 01:56:36
合計ジャッジ時間 5,598 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,552 KB
testcase_01 AC 18 ms
8,556 KB
testcase_02 AC 18 ms
8,512 KB
testcase_03 AC 20 ms
8,728 KB
testcase_04 AC 20 ms
8,780 KB
testcase_05 AC 20 ms
8,732 KB
testcase_06 AC 20 ms
8,780 KB
testcase_07 AC 21 ms
8,808 KB
testcase_08 AC 21 ms
8,720 KB
testcase_09 AC 215 ms
31,976 KB
testcase_10 AC 214 ms
31,932 KB
testcase_11 AC 216 ms
31,588 KB
testcase_12 AC 208 ms
31,080 KB
testcase_13 AC 208 ms
30,960 KB
testcase_14 AC 209 ms
30,960 KB
testcase_15 AC 176 ms
24,864 KB
testcase_16 AC 187 ms
24,920 KB
testcase_17 AC 182 ms
25,760 KB
testcase_18 AC 213 ms
30,396 KB
testcase_19 AC 118 ms
8,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n, m=map(int, input().split())
a=deque(map(int, input().split()))
s=input()
for c in s:
    if c=='L':
        a0=a[0]
        a1=a[1]
        a.popleft()
        a.popleft()
        a.appendleft(a0+a1)
        a.append(0)
    else:
        a0=a[n-1]
        a1=a[n-2]
        a.pop()
        a.pop()
        a.append(a0+a1)
        a.appendleft(0)
print(' '.join(map(str, a)))
0