結果

問題 No.1021 Children in Classrooms
ユーザー 👑 timitimi
提出日時 2020-10-09 17:18:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 31,168 KB
最終ジャッジ日時 2023-09-27 12:43:32
合計ジャッジ時間 6,102 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,884 KB
testcase_01 AC 14 ms
7,768 KB
testcase_02 AC 13 ms
7,964 KB
testcase_03 AC 16 ms
8,364 KB
testcase_04 AC 19 ms
8,212 KB
testcase_05 AC 18 ms
8,360 KB
testcase_06 AC 18 ms
8,596 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 299 ms
30,740 KB
testcase_10 AC 282 ms
30,800 KB
testcase_11 AC 289 ms
30,776 KB
testcase_12 AC 303 ms
30,892 KB
testcase_13 AC 299 ms
30,764 KB
testcase_14 AC 306 ms
30,720 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 326 ms
31,168 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int, input().split())
A=list(map(int, input().split()))
s=input()
c=0
cmi,cma=0,0
for i in s:
  if i=='L':
    c-=1
  else:
    c+=1
  cmi=min(cmi,c)
  cma=max(cma,c)
cmi*=(-1)
d=0
for i in range(min(cmi,N-1)):
  A[i+1]+=A[i]
  A[i]=0
for i in range(min(cma,N-1)):
  A[-2-i]+=A[-1-i]
  A[-1-i]=0
c=min(N-1,c)
c=max(-N+1,c)
if c==0:
  print(*A)
elif c>0:
  ans=[0]*c
  for i in range(N-c):
    ans.append(A[i])
  print(*ans)
else:
  c*=-1
  ans=[]
  for i in range(c,N):
    ans.append(A[i])
  ans=ans+[0]*c
  print(*ans)
0