結果
| 問題 |
No.1021 Children in Classrooms
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-11 00:18:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 176 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 29,560 KB |
| 最終ジャッジ日時 | 2024-09-16 04:19:13 |
| 合計ジャッジ時間 | 4,623 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 6 |
ソースコード
import sys
from collections import deque
n, m = map(int, sys.stdin.readline().split())
a = deque(map(int, sys.stdin.readline().split()))
s = sys.stdin.readline().rstrip()
def main():
l = r = 0
for c in s:
if c == 'L':
if l == 0:
if len(a) == 1:
continue
b = a.popleft()
a[0] += b
r += 1
l = max(0, l - 1)
else:
if r == 0:
if len(a) == 0:
continue
b = a.pop()
a[-1] += b
r = max(0, r - 1)
l += 1
if len(a) == 1:
break
res = [0] * l + list(a) + [0] * r
print(*res, sep=' ')
if __name__ == '__main__':
main()