結果

問題 No.1021 Children in Classrooms
ユーザー titiatitia
提出日時 2020-04-10 21:29:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 1,046 ms
コンパイル使用メモリ 10,424 KB
実行使用メモリ 30,308 KB
最終ジャッジ日時 2023-10-13 23:21:04
合計ジャッジ時間 4,309 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,420 KB
testcase_01 AC 16 ms
8,404 KB
testcase_02 AC 16 ms
8,544 KB
testcase_03 AC 19 ms
8,636 KB
testcase_04 AC 19 ms
8,636 KB
testcase_05 AC 18 ms
8,668 KB
testcase_06 AC 19 ms
8,596 KB
testcase_07 AC 18 ms
8,832 KB
testcase_08 AC 19 ms
8,800 KB
testcase_09 AC 190 ms
30,120 KB
testcase_10 AC 197 ms
30,088 KB
testcase_11 AC 196 ms
30,188 KB
testcase_12 AC 194 ms
30,128 KB
testcase_13 AC 196 ms
30,196 KB
testcase_14 AC 192 ms
30,080 KB
testcase_15 AC 162 ms
24,780 KB
testcase_16 AC 163 ms
24,940 KB
testcase_17 AC 169 ms
25,704 KB
testcase_18 AC 194 ms
30,308 KB
testcase_19 AC 74 ms
8,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

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

for s in S:
    if s=="L":
        x=A.popleft()
        A[0]+=x
        A.append(0)
    else:
        x=A.pop()
        A[-1]+=x
        A.appendleft(0)

print(*A)

0