結果

問題 No.1021 Children in Classrooms
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-07-01 21:04:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 847 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 118,696 KB
最終ジャッジ日時 2023-09-10 19:14:43
合計ジャッジ時間 7,434 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,228 KB
testcase_01 AC 72 ms
71,448 KB
testcase_02 AC 73 ms
71,172 KB
testcase_03 AC 95 ms
76,692 KB
testcase_04 AC 85 ms
76,976 KB
testcase_05 AC 86 ms
76,748 KB
testcase_06 AC 86 ms
76,724 KB
testcase_07 AC 87 ms
76,744 KB
testcase_08 AC 90 ms
77,056 KB
testcase_09 AC 163 ms
107,064 KB
testcase_10 AC 159 ms
106,944 KB
testcase_11 AC 155 ms
106,840 KB
testcase_12 AC 155 ms
106,968 KB
testcase_13 AC 155 ms
106,700 KB
testcase_14 AC 150 ms
107,172 KB
testcase_15 AC 132 ms
100,048 KB
testcase_16 AC 132 ms
100,180 KB
testcase_17 AC 132 ms
100,352 KB
testcase_18 AC 146 ms
118,696 KB
testcase_19 AC 90 ms
76,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
a=list(map(int,input().split()))
s=input()
stat=0
for o in s:
  if o=='L':
    stat+=1
    if 0<stat<n:
      a[stat]+=a[stat-1]
      a[stat-1]=0
    if stat==n:stat=n-1
  else:
    stat-=1
    if -n<stat<0:
      a[stat-1]+=a[stat]
      a[stat]=0
    if stat==-n:stat=-n+1
a=list(a)
if stat==0:
  print(*a)
else:
  print(*a[stat:]+a[:stat])

0