結果

問題 No.1021 Children in Classrooms
ユーザー kbyskbys
提出日時 2020-06-05 22:17:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 10,544 KB
実行使用メモリ 31,404 KB
最終ジャッジ日時 2023-08-22 16:02:43
合計ジャッジ時間 5,686 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,600 KB
testcase_01 AC 19 ms
8,564 KB
testcase_02 AC 18 ms
8,620 KB
testcase_03 AC 21 ms
8,660 KB
testcase_04 AC 20 ms
8,804 KB
testcase_05 AC 21 ms
8,620 KB
testcase_06 AC 20 ms
8,880 KB
testcase_07 AC 21 ms
8,964 KB
testcase_08 AC 21 ms
8,728 KB
testcase_09 AC 216 ms
31,088 KB
testcase_10 AC 214 ms
31,032 KB
testcase_11 AC 219 ms
30,992 KB
testcase_12 AC 214 ms
31,052 KB
testcase_13 AC 212 ms
31,148 KB
testcase_14 AC 213 ms
30,988 KB
testcase_15 AC 180 ms
25,636 KB
testcase_16 AC 179 ms
25,652 KB
testcase_17 AC 189 ms
26,592 KB
testcase_18 AC 218 ms
31,404 KB
testcase_19 AC 90 ms
8,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

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

for i in S:
    if i == "L":
        a0 = A.popleft()
        a1 = A.popleft()
        A.appendleft(a0+a1)
        A.append(0)
    else:
        a0 = A.pop()
        a1 = A.pop()
        A.append(a0+a1)
        A.appendleft(0)
print(*A)
0