結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,068 KB
testcase_01 AC 15 ms
8,052 KB
testcase_02 AC 14 ms
7,964 KB
testcase_03 AC 18 ms
8,284 KB
testcase_04 AC 18 ms
8,244 KB
testcase_05 AC 17 ms
8,336 KB
testcase_06 AC 17 ms
8,224 KB
testcase_07 AC 19 ms
8,448 KB
testcase_08 AC 18 ms
8,572 KB
testcase_09 AC 338 ms
30,736 KB
testcase_10 AC 329 ms
30,676 KB
testcase_11 AC 335 ms
30,800 KB
testcase_12 AC 357 ms
30,804 KB
testcase_13 AC 333 ms
30,776 KB
testcase_14 AC 340 ms
30,708 KB
testcase_15 AC 304 ms
25,224 KB
testcase_16 AC 320 ms
25,392 KB
testcase_17 AC 314 ms
27,304 KB
testcase_18 AC 362 ms
31,108 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
  if c<-1*(N-1):
    c+=1
  if c>(N-1):
    c-=1
  cmi=min(cmi,c)
  cma=max(cma,c)
  
cmi*=(-1)
d=0
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
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