結果

問題 No.1021 Children in Classrooms
ユーザー wattaiheiwattaihei
提出日時 2020-05-23 18:14:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 30,484 KB
最終ジャッジ日時 2024-04-17 05:17:32
合計ジャッジ時間 5,132 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
10,496 KB
testcase_01 AC 33 ms
10,496 KB
testcase_02 AC 31 ms
10,496 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 33 ms
10,752 KB
testcase_05 AC 35 ms
10,880 KB
testcase_06 AC 32 ms
10,880 KB
testcase_07 AC 33 ms
10,752 KB
testcase_08 AC 34 ms
10,880 KB
testcase_09 AC 292 ms
30,000 KB
testcase_10 AC 284 ms
30,100 KB
testcase_11 AC 291 ms
30,124 KB
testcase_12 AC 303 ms
30,248 KB
testcase_13 AC 285 ms
30,120 KB
testcase_14 AC 278 ms
30,252 KB
testcase_15 AC 232 ms
25,388 KB
testcase_16 AC 241 ms
25,344 KB
testcase_17 AC 242 ms
25,928 KB
testcase_18 AC 285 ms
30,484 KB
testcase_19 AC 108 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import deque

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

q = deque()
for a in A:
    q.append(a)


for s in S:
    if s == "L":
        q.append(0)
        a = q.popleft()
        b = q.popleft()
        q.appendleft(a+b)
    else:
        q.appendleft(0)
        a = q.pop()
        b = q.pop()
        q.append(a+b)

print(*q)
0