結果

問題 No.1021 Children in Classrooms
ユーザー DrDrpilotDrDrpilot
提出日時 2022-02-07 18:26:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 10,580 KB
実行使用メモリ 32,252 KB
最終ジャッジ日時 2023-09-04 02:13:30
合計ジャッジ時間 5,515 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,564 KB
testcase_01 AC 19 ms
8,528 KB
testcase_02 AC 19 ms
8,516 KB
testcase_03 AC 21 ms
8,684 KB
testcase_04 AC 21 ms
8,732 KB
testcase_05 AC 21 ms
8,804 KB
testcase_06 AC 21 ms
8,852 KB
testcase_07 AC 22 ms
8,800 KB
testcase_08 AC 22 ms
8,700 KB
testcase_09 AC 238 ms
32,240 KB
testcase_10 AC 236 ms
32,132 KB
testcase_11 AC 237 ms
32,252 KB
testcase_12 AC 235 ms
32,128 KB
testcase_13 AC 237 ms
32,124 KB
testcase_14 AC 238 ms
32,188 KB
testcase_15 AC 191 ms
25,524 KB
testcase_16 AC 194 ms
26,432 KB
testcase_17 AC 196 ms
27,220 KB
testcase_18 AC 228 ms
31,592 KB
testcase_19 AC 87 ms
8,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m=map(int,input().split())
a=list(map(int,input().split()))
s=input()
q=deque()
for i in a:
    q.append(i)
for i in s:
    if i=='L':
        out1=q.popleft()
        out2=q.popleft()
        q.appendleft(out1+out2)
        q.append(0)
    else:
        out1=q.pop()
        out2=q.pop()
        q.append(out1+out2)
        q.appendleft(0)
print(*q)
0