結果

問題 No.1021 Children in Classrooms
ユーザー ptotqptotq
提出日時 2020-04-10 21:35:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 10,624 KB
実行使用メモリ 30,524 KB
最終ジャッジ日時 2023-10-13 23:36:48
合計ジャッジ時間 3,906 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,624 KB
testcase_01 AC 18 ms
8,484 KB
testcase_02 AC 18 ms
8,492 KB
testcase_03 AC 21 ms
8,776 KB
testcase_04 AC 21 ms
8,776 KB
testcase_05 AC 20 ms
8,644 KB
testcase_06 AC 21 ms
8,632 KB
testcase_07 AC 21 ms
8,720 KB
testcase_08 AC 21 ms
8,796 KB
testcase_09 AC 207 ms
30,200 KB
testcase_10 AC 211 ms
30,184 KB
testcase_11 AC 207 ms
30,120 KB
testcase_12 AC 206 ms
30,200 KB
testcase_13 AC 205 ms
30,104 KB
testcase_14 AC 207 ms
30,128 KB
testcase_15 AC 169 ms
24,908 KB
testcase_16 AC 173 ms
25,080 KB
testcase_17 AC 176 ms
25,916 KB
testcase_18 AC 206 ms
30,524 KB
testcase_19 AC 83 ms
8,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
dq = deque(map(int, input().split()))

for c in input().rstrip():
    if c == 'L':
        x = dq.popleft()
        dq[0] += x
        dq.append(0)
    else:
        x = dq.pop()
        dq[-1] += x
        dq.appendleft(0)

print(*dq)
0