結果

問題 No.1021 Children in Classrooms
ユーザー ronpooronpoo
提出日時 2023-11-21 15:12:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 106,864 KB
最終ジャッジ日時 2023-11-21 15:13:01
合計ジャッジ時間 3,551 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 55 ms
66,912 KB
testcase_04 AC 56 ms
66,908 KB
testcase_05 AC 55 ms
66,908 KB
testcase_06 AC 55 ms
66,908 KB
testcase_07 AC 56 ms
66,908 KB
testcase_08 AC 55 ms
66,908 KB
testcase_09 AC 152 ms
106,864 KB
testcase_10 AC 149 ms
106,736 KB
testcase_11 AC 137 ms
106,864 KB
testcase_12 AC 137 ms
106,864 KB
testcase_13 AC 138 ms
106,864 KB
testcase_14 AC 132 ms
106,864 KB
testcase_15 AC 122 ms
102,172 KB
testcase_16 AC 121 ms
102,168 KB
testcase_17 AC 124 ms
101,944 KB
testcase_18 AC 124 ms
106,544 KB
testcase_19 AC 52 ms
66,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

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

q = deque(A)
for i in range(M):
    if S[i] == 'L':
        x = q.popleft()
        x += q.popleft()
        q.appendleft(x)
        q.append(0)        
    else:
        x = q.pop()
        x += q.pop()
        q.append(x)
        q.appendleft(0)        
print(*q, sep=' ')
0