結果
| 問題 |
No.1021 Children in Classrooms
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-04-11 00:46:48 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 381 ms / 2,000 ms |
| コード長 | 470 bytes |
| コンパイル時間 | 178 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 30,488 KB |
| 最終ジャッジ日時 | 2024-09-16 04:48:54 |
| 合計ジャッジ時間 | 5,737 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
N, M = map(int, input().split())
a = list(map(int, input().split()))
S = input()
t = 0
for c in S:
if c == 'L':
t = max(t - 1, -N + 1)
if t < 0:
a[-t] += a[-(t + 1)]
a[-(t + 1)] = 0
elif c == 'R':
t = min(t + 1, N - 1)
if t > 0:
a[N - 1 - t] += a[N - t]
a[N - t] = 0
if t > 0:
print(*(([0] * t) + a)[:N])
elif t < 0:
print(*(a + ([0] * -t))[-t:N - t])
else:
print(*a)
c-yan