結果

問題 No.1021 Children in Classrooms
ユーザー 👑 KazunKazun
提出日時 2020-06-10 17:48:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 112,932 KB
最終ジャッジ日時 2023-09-05 14:28:11
合計ジャッジ時間 5,469 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,504 KB
testcase_01 AC 99 ms
71,472 KB
testcase_02 AC 99 ms
71,892 KB
testcase_03 AC 122 ms
78,204 KB
testcase_04 AC 112 ms
78,416 KB
testcase_05 AC 113 ms
78,316 KB
testcase_06 AC 111 ms
78,056 KB
testcase_07 AC 113 ms
78,068 KB
testcase_08 AC 113 ms
78,240 KB
testcase_09 AC 200 ms
112,884 KB
testcase_10 AC 211 ms
112,656 KB
testcase_11 AC 197 ms
112,652 KB
testcase_12 AC 197 ms
112,628 KB
testcase_13 AC 198 ms
112,432 KB
testcase_14 AC 192 ms
112,932 KB
testcase_15 AC 177 ms
103,932 KB
testcase_16 AC 178 ms
104,128 KB
testcase_17 AC 182 ms
104,348 KB
testcase_18 AC 184 ms
112,508 KB
testcase_19 AC 108 ms
77,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N,M=map(int,input().split())
A=list(map(int,input().split()))
S=input()

Q=deque(A)
for d in S:
    if d=="L":
        a=Q.popleft()
        b=Q.popleft()
        Q.appendleft(a+b)
        Q.append(0)
    else:
        a=Q.pop()
        b=Q.pop()
        Q.append(a+b)
        Q.appendleft(0)

for i in range(N):
    a=Q.popleft()
    print(a,end=" ")
print()
0