結果

問題 No.1021 Children in Classrooms
ユーザー 👑 timitimi
提出日時 2020-10-12 16:34:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 32,460 KB
最終ジャッジ日時 2023-09-27 23:43:02
合計ジャッジ時間 5,406 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,760 KB
testcase_01 AC 13 ms
7,940 KB
testcase_02 AC 13 ms
7,808 KB
testcase_03 AC 17 ms
8,444 KB
testcase_04 AC 17 ms
8,524 KB
testcase_05 AC 17 ms
8,328 KB
testcase_06 AC 17 ms
8,284 KB
testcase_07 AC 18 ms
8,592 KB
testcase_08 AC 20 ms
8,404 KB
testcase_09 AC 346 ms
30,700 KB
testcase_10 AC 350 ms
30,660 KB
testcase_11 AC 356 ms
30,820 KB
testcase_12 AC 364 ms
30,780 KB
testcase_13 AC 361 ms
30,828 KB
testcase_14 AC 359 ms
30,680 KB
testcase_15 AC 336 ms
25,204 KB
testcase_16 AC 363 ms
26,000 KB
testcase_17 AC 332 ms
26,196 KB
testcase_18 AC 425 ms
32,460 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int, input().split())
A=list(map(int, input().split()))
s=input()
L,R=0,N-1
d=0
cmi,cma=0,0
for i in s:
    if i=='L':
        L=max(0,L-1)
        R=max(0,R-1)
        d-=1
        if d==-N:
            d+=1
        cmi=min(d,cmi)
    else:
        L=min(N-1,L+1)
        R=min(N-1,R+1)
        d+=1
        if d==N:
            d-=1
        cma=max(d,cma)

cmi*=-1
for i in range(cmi):
    A[i+1]+=A[i]
    A[i]=0
for i in range(cma):
    A[-2-i]+=A[-1-i]
    A[-1-i]=0

B=A[cmi:N-cma]
ans=[0]*L+B+[0]*(N-R-1)
print(*ans)
0