結果

問題 No.1021 Children in Classrooms
ユーザー takakin
提出日時 2020-05-23 20:02:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 492 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 30,628 KB
最終ジャッジ日時 2024-10-08 22:13:18
合計ジャッジ時間 7,919 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,m=map(int,input().split())
A=[int(i) for i in input().split()]
S=input()
ct1,ct2,ct3=0,0,0
for s in S:
  if s=="L":
    if ct1==-(n-1):
      continue
    else:
      ct1-=1
  else:
    if ct1==n-1:
      continue
    else:
      ct1+=1
  ct2=max(ct1,ct2)
  ct3=min(ct1,ct3)
Ans=[0]*n
for i in range(n):
  if i<abs(ct3):
    Ans[abs(ct3)+ct1]+=A[i]
  elif i>=n-1-ct2:
    Ans[n-1-ct2+ct1]+=A[i]
  else:
    Ans[i+ct1]+=A[i]
print(*Ans)
0