結果

問題 No.1021 Children in Classrooms
ユーザー c-yanc-yan
提出日時 2020-04-11 00:46:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 304 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 32,592 KB
最終ジャッジ日時 2023-10-14 09:51:10
合計ジャッジ時間 4,816 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,916 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 14 ms
7,788 KB
testcase_03 AC 17 ms
8,372 KB
testcase_04 AC 17 ms
8,348 KB
testcase_05 AC 17 ms
8,280 KB
testcase_06 AC 17 ms
8,424 KB
testcase_07 AC 18 ms
8,560 KB
testcase_08 AC 18 ms
8,484 KB
testcase_09 AC 274 ms
31,768 KB
testcase_10 AC 270 ms
31,632 KB
testcase_11 AC 269 ms
31,784 KB
testcase_12 AC 272 ms
31,648 KB
testcase_13 AC 271 ms
31,604 KB
testcase_14 AC 271 ms
31,800 KB
testcase_15 AC 254 ms
25,264 KB
testcase_16 AC 264 ms
26,108 KB
testcase_17 AC 259 ms
26,056 KB
testcase_18 AC 304 ms
32,592 KB
testcase_19 AC 142 ms
8,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0