結果

問題 No.1021 Children in Classrooms
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-06-27 16:03:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 31,448 KB
最終ジャッジ日時 2023-09-07 18:01:01
合計ジャッジ時間 5,594 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,632 KB
testcase_01 AC 19 ms
8,580 KB
testcase_02 AC 18 ms
8,648 KB
testcase_03 AC 20 ms
8,716 KB
testcase_04 AC 22 ms
8,880 KB
testcase_05 AC 20 ms
8,632 KB
testcase_06 AC 21 ms
8,856 KB
testcase_07 AC 21 ms
8,944 KB
testcase_08 AC 20 ms
8,728 KB
testcase_09 AC 215 ms
31,104 KB
testcase_10 AC 215 ms
31,136 KB
testcase_11 AC 213 ms
31,180 KB
testcase_12 AC 213 ms
31,132 KB
testcase_13 AC 213 ms
31,084 KB
testcase_14 AC 214 ms
31,180 KB
testcase_15 AC 178 ms
25,556 KB
testcase_16 AC 180 ms
25,756 KB
testcase_17 AC 184 ms
26,488 KB
testcase_18 AC 212 ms
31,448 KB
testcase_19 AC 85 ms
8,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n, m = map(int, input().split())

a = deque(list(map(int, input().split())))
s = input()
for i in s:
    if i == "L":
        p1, p2 = a.popleft(), a.popleft()
        a.appendleft(p1 + p2)
        a.append(0)
    else:
        p1, p2 = a.pop(), a.pop()
        a.append(p1 + p2)
        a.appendleft(0)
print(*a)
0