結果

問題 No.1021 Children in Classrooms
ユーザー 👑 KazunKazun
提出日時 2020-06-10 17:40:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 107,532 KB
最終ジャッジ日時 2023-09-05 14:10:30
合計ジャッジ時間 6,141 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,500 KB
testcase_01 AC 73 ms
71,564 KB
testcase_02 AC 74 ms
71,448 KB
testcase_03 AC 94 ms
76,912 KB
testcase_04 AC 94 ms
76,952 KB
testcase_05 AC 95 ms
76,952 KB
testcase_06 AC 94 ms
77,056 KB
testcase_07 AC 93 ms
76,956 KB
testcase_08 AC 100 ms
76,920 KB
testcase_09 AC 151 ms
106,920 KB
testcase_10 AC 151 ms
107,060 KB
testcase_11 AC 151 ms
107,028 KB
testcase_12 AC 162 ms
107,112 KB
testcase_13 AC 162 ms
107,068 KB
testcase_14 AC 162 ms
107,144 KB
testcase_15 AC 142 ms
100,280 KB
testcase_16 AC 140 ms
100,308 KB
testcase_17 AC 144 ms
100,308 KB
testcase_18 AC 139 ms
107,532 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
S=input()

m=0
x,y=0,0
for d in S:
    if d=="L":
        m=max(m-1,-(N-1))
        x=min(m,x)
    else:
        m=min(m+1,N-1)
        y=max(m,y)

x=-x
y=(N-1)-y
for i in range(N):
    if i<x:
        A[x]+=A[i]
        A[i]=0
    elif y<i:
        A[y]+=A[i]
        A[i]=0

for i in range(N):
    if 0<=i-m<N:
        print(A[i-m],end=" ")
    else:
        print(0,end=" ")
print()
    
0