結果
| 問題 | No.1021 Children in Classrooms |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-20 22:38:24 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 166 ms / 2,000 ms |
| コード長 | 534 bytes |
| 記録 | |
| コンパイル時間 | 558 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 34,408 KB |
| 最終ジャッジ日時 | 2026-04-22 08:26:10 |
| 合計ジャッジ時間 | 4,225 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
from collections import deque
def main():
n, m = map(int, input().split())
a = [int(x) for x in input().split()]
s = list(input())
a = deque(a)
for now_op in s:
if now_op == "L":
left = a.popleft()
left += a.popleft()
a.appendleft(left)
a.append(0)
else:
right = a.pop()
right += a.pop()
a.append(right)
a.appendleft(0)
print(" ".join(map(str, list(a))))
if __name__ == '__main__':
main()