結果

問題 No.1021 Children in Classrooms
ユーザー y61mpnly61mpnl
提出日時 2020-04-10 22:03:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 32,648 KB
最終ジャッジ日時 2023-10-14 00:34:37
合計ジャッジ時間 4,840 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,952 KB
testcase_01 AC 15 ms
7,900 KB
testcase_02 AC 15 ms
7,768 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(int, input().split()))
s = input()

b, mx, mn = [0]*3
for i in s:
        if i=='R': b += 1
        else: b -= 1
        mx = max(mx, b)
        mn = min(mn, b)
mx = min(mx, n-1)
mn = max(mn, -n+1)
b = min(mx, max(mn, b))

for i in range(-mn, 0, -1):
        a[i] += a[i-1]
        a[i-1] = 0
for i in range(n-mx-1, n-1):
        a[i] += a[i+1]
        a[i+1] = 0

if b>0: print(*([0]*b + a[:-b]))
else: print(*(a[b:] + [0]*-b))
0