結果

問題 No.1021 Children in Classrooms
ユーザー kohei2019kohei2019
提出日時 2022-05-15 15:37:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 1,626 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 109,024 KB
最終ジャッジ日時 2023-10-10 00:11:39
合計ジャッジ時間 7,066 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,532 KB
testcase_01 AC 65 ms
71,252 KB
testcase_02 AC 64 ms
71,592 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 94 ms
76,924 KB
testcase_06 AC 79 ms
76,652 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 144 ms
106,928 KB
testcase_10 AC 142 ms
107,004 KB
testcase_11 WA -
testcase_12 AC 138 ms
107,084 KB
testcase_13 AC 141 ms
106,924 KB
testcase_14 AC 141 ms
107,048 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
lsA = list(map(int,input().split()))
S = input()
l = 0
r = 0
c = 0
for i in range(M):
    if S[i] == 'L':
        c -= 1
        l = min(l,c)
    else:
        c += 1
        r = max(r,c)
ans = [0]*N
l = abs(l)
if r+l >= N-1:
    ans[0] = sum(lsA)
else:
    ans = lsA[:]
    for i in range(l):
        ans[i+1] += ans[i]
        ans[i] = 0
    for i in range(N-1,N-1-r,-1):
        ans[i-1] += ans[i]
        ans[i] = 0
    ind = S.count('R')-S.count('L')
    if ind < 0:
        ans = ans[ind:]+[0]*ind
    elif ind > 0:
        ans = [0]*ind+ans[:-ind]
print(*ans)
0