結果

問題 No.1021 Children in Classrooms
ユーザー NoneNone
提出日時 2021-03-04 17:08:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 113,152 KB
最終ジャッジ日時 2024-04-15 09:30:44
合計ジャッジ時間 4,178 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 42 ms
51,712 KB
testcase_02 AC 48 ms
51,968 KB
testcase_03 AC 65 ms
64,256 KB
testcase_04 AC 63 ms
64,384 KB
testcase_05 AC 64 ms
64,256 KB
testcase_06 AC 63 ms
64,512 KB
testcase_07 AC 63 ms
64,512 KB
testcase_08 WA -
testcase_09 AC 143 ms
105,984 KB
testcase_10 AC 132 ms
105,660 KB
testcase_11 AC 131 ms
105,572 KB
testcase_12 AC 138 ms
105,856 KB
testcase_13 AC 138 ms
105,920 KB
testcase_14 AC 140 ms
106,072 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 114 ms
99,328 KB
testcase_18 WA -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int, input().split())
A=list(map(int, input().split()))
S=input().rstrip()
l,r=0,N-1
c=0
for s in S:
    if l==r and s=="L" and c<0:
        continue
    if l==r and s=="R" and c>N-1:
        continue

    if s=="L":
        c-=1
    else:
        c+=1
    if l+c<0:
        A[l+1]+=A[l]
        A[l]=0
        l+=1
    if r+c>N-1:
        A[r-1]+=A[r]
        A[r]=0
        r-=1

res=[0]*N

for i in range(l+c,r+c+1):
    res[i]=A[i-c]


print(*res)
0