結果
| 問題 |
No.1021 Children in Classrooms
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2020-06-10 17:48:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 154 ms / 2,000 ms |
| コード長 | 391 bytes |
| コンパイル時間 | 789 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 107,136 KB |
| 最終ジャッジ日時 | 2024-06-23 10:08:18 |
| 合計ジャッジ時間 | 3,757 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
from collections import deque
N,M=map(int,input().split())
A=list(map(int,input().split()))
S=input()
Q=deque(A)
for d in S:
if d=="L":
a=Q.popleft()
b=Q.popleft()
Q.appendleft(a+b)
Q.append(0)
else:
a=Q.pop()
b=Q.pop()
Q.append(a+b)
Q.appendleft(0)
for i in range(N):
a=Q.popleft()
print(a,end=" ")
print()
Kazun