結果

問題 No.1021 Children in Classrooms
ユーザー hirakuhiraku
提出日時 2020-04-12 20:14:20
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 234 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 11,852 KB
実行使用メモリ 33,928 KB
最終ジャッジ日時 2023-10-22 06:22:25
合計ジャッジ時間 5,960 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,176 KB
testcase_01 AC 29 ms
10,176 KB
testcase_02 AC 29 ms
10,176 KB
testcase_03 AC 31 ms
10,364 KB
testcase_04 AC 31 ms
10,428 KB
testcase_05 AC 32 ms
10,352 KB
testcase_06 AC 30 ms
10,412 KB
testcase_07 AC 32 ms
10,476 KB
testcase_08 AC 32 ms
10,468 KB
testcase_09 AC 233 ms
33,916 KB
testcase_10 AC 230 ms
33,888 KB
testcase_11 AC 234 ms
33,920 KB
testcase_12 AC 233 ms
33,924 KB
testcase_13 AC 232 ms
33,920 KB
testcase_14 AC 230 ms
33,928 KB
testcase_15 AC 195 ms
27,140 KB
testcase_16 AC 197 ms
28,324 KB
testcase_17 AC 199 ms
28,956 KB
testcase_18 AC 233 ms
33,248 KB
testcase_19 AC 90 ms
10,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n, m = map(int, input().split())
A = list(map(int, input().split()))
S = input()

q = deque(A)

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

print(*q)
0