結果

問題 No.1021 Children in Classrooms
ユーザー flippergoflippergo
提出日時 2021-01-02 09:56:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 82,156 KB
実行使用メモリ 107,652 KB
最終ジャッジ日時 2024-04-20 04:14:39
合計ジャッジ時間 3,450 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,004 KB
testcase_01 AC 37 ms
54,616 KB
testcase_02 AC 36 ms
54,980 KB
testcase_03 AC 57 ms
67,892 KB
testcase_04 AC 52 ms
67,588 KB
testcase_05 AC 52 ms
67,744 KB
testcase_06 AC 53 ms
67,292 KB
testcase_07 AC 53 ms
68,500 KB
testcase_08 AC 51 ms
67,764 KB
testcase_09 AC 129 ms
107,388 KB
testcase_10 AC 131 ms
107,564 KB
testcase_11 AC 128 ms
107,612 KB
testcase_12 AC 131 ms
107,652 KB
testcase_13 AC 131 ms
107,532 KB
testcase_14 AC 129 ms
107,628 KB
testcase_15 AC 113 ms
102,500 KB
testcase_16 AC 112 ms
102,380 KB
testcase_17 AC 113 ms
102,528 KB
testcase_18 AC 121 ms
107,540 KB
testcase_19 AC 61 ms
76,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N,M = map(int,input().split())
A = deque(list(map(int,input().split())))
S = input().strip()
cntL = 0
cntR = 0
for i in range(M):
    if S[i]=="L":
        A[-1] += cntR
        cntR = 0
        cntL += A.popleft()
        A.append(0)
    else:
        A[0] += cntL
        cntL = 0
        cntR += A.pop()
        A.appendleft(0)
A[0] += cntL
A[-1] += cntR
print(*A)
0