結果

問題 No.1021 Children in Classrooms
ユーザー takakintakakin
提出日時 2020-05-23 20:31:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 30,648 KB
最終ジャッジ日時 2024-04-17 09:13:22
合計ジャッジ時間 6,691 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,624 KB
testcase_01 AC 29 ms
10,624 KB
testcase_02 AC 29 ms
10,624 KB
testcase_03 AC 33 ms
11,008 KB
testcase_04 AC 33 ms
10,880 KB
testcase_05 AC 33 ms
10,880 KB
testcase_06 AC 34 ms
11,008 KB
testcase_07 AC 33 ms
10,880 KB
testcase_08 AC 34 ms
11,008 KB
testcase_09 AC 499 ms
30,164 KB
testcase_10 AC 499 ms
30,268 KB
testcase_11 AC 501 ms
30,292 KB
testcase_12 AC 509 ms
30,168 KB
testcase_13 AC 502 ms
30,292 KB
testcase_14 AC 508 ms
30,292 KB
testcase_15 AC 353 ms
25,428 KB
testcase_16 AC 355 ms
25,576 KB
testcase_17 AC 362 ms
26,224 KB
testcase_18 AC 402 ms
30,648 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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
chk=False
for s in S:
  if s=="L":
    if ct1==-(n-1):
      chk=True
      last="l"
      continue
    else:
      ct1-=1
  else:
    if ct1==n-1:
      chk=True
      last="r"
      continue
    else:
      ct1+=1
  ct2=max(ct1,ct2)
  ct3=min(ct1,ct3)
Ans=[0]*n
if chk:
  if last=="l":
    Ans[min(n-1,ct1+n-1)]+=sum(A)
  else:
    Ans[max(0,ct1)]+=sum(A)
else:
  for i in range(n):
    if i<abs(ct3):
      Ans[abs(ct3)+ct1]+=A[i]
    elif i>=n-ct2:
      Ans[n-1-ct2+ct1]+=A[i]
    else:
      Ans[i+ct1]+=A[i]
print(*Ans)
0