結果

問題 No.1021 Children in Classrooms
ユーザー 👑 timitimi
提出日時 2020-10-12 16:54:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,640 KB
実行使用メモリ 31,948 KB
最終ジャッジ日時 2023-09-27 23:44:20
合計ジャッジ時間 3,642 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,580 KB
testcase_01 AC 15 ms
8,576 KB
testcase_02 AC 15 ms
8,584 KB
testcase_03 AC 18 ms
8,792 KB
testcase_04 AC 18 ms
8,696 KB
testcase_05 AC 18 ms
8,672 KB
testcase_06 AC 18 ms
8,836 KB
testcase_07 AC 19 ms
8,828 KB
testcase_08 AC 17 ms
8,812 KB
testcase_09 AC 204 ms
31,824 KB
testcase_10 AC 201 ms
31,808 KB
testcase_11 AC 202 ms
31,948 KB
testcase_12 AC 198 ms
31,796 KB
testcase_13 AC 204 ms
31,804 KB
testcase_14 AC 202 ms
31,884 KB
testcase_15 AC 161 ms
25,272 KB
testcase_16 AC 165 ms
26,168 KB
testcase_17 AC 172 ms
26,832 KB
testcase_18 AC 192 ms
31,024 KB
testcase_19 AC 80 ms
8,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int, input().split())
A=list(map(int, input().split()))
s=input()
from collections import deque
d=deque(A)
for i in s:
    if i=='L':
        a=d.popleft()
        b=d.popleft()
        d.appendleft(a+b)
        d.append(0)
    else:
        a=d.pop()
        b=d.pop()
        d.appendleft(0)
        d.append(a+b)
print(*d)
0