結果

問題 No.1021 Children in Classrooms
コンテスト
ユーザー 👑 Kazun
提出日時 2020-06-10 17:40:49
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 453 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 158 ms
コンパイル使用メモリ 85,160 KB
実行使用メモリ 111,976 KB
最終ジャッジ日時 2026-03-08 03:12:01
合計ジャッジ時間 2,648 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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