結果

問題 No.1021 Children in Classrooms
ユーザー rlangevinrlangevin
提出日時 2023-01-21 16:14:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 565 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 116,156 KB
最終ジャッジ日時 2023-09-06 05:05:58
合計ジャッジ時間 6,348 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
74,600 KB
testcase_01 AC 71 ms
74,432 KB
testcase_02 AC 73 ms
74,532 KB
testcase_03 AC 88 ms
79,896 KB
testcase_04 AC 89 ms
80,152 KB
testcase_05 AC 89 ms
80,068 KB
testcase_06 AC 89 ms
80,140 KB
testcase_07 AC 91 ms
80,036 KB
testcase_08 AC 91 ms
80,180 KB
testcase_09 AC 181 ms
116,024 KB
testcase_10 AC 182 ms
116,080 KB
testcase_11 AC 183 ms
116,156 KB
testcase_12 AC 189 ms
116,128 KB
testcase_13 AC 198 ms
116,028 KB
testcase_14 AC 189 ms
116,148 KB
testcase_15 AC 161 ms
110,912 KB
testcase_16 AC 158 ms
110,412 KB
testcase_17 AC 159 ms
110,500 KB
testcase_18 AC 174 ms
115,492 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
A = list(map(int, input().split())) + [0]*202020
S = list(input())

maxv = 0
minv = 0
now, val = 0, 0
for s in S:
    if s == "L":
        val -= 1
        now -= 1
    else:
        val += 1
        now += 1
    maxv = max(maxv, val)
    minv = min(minv, val)
    now = max(0, now)
    
minv = abs(minv)
for i in range(minv - 1, -1, -1):
    A[minv] += A[i]
    A[i] = 0
for i in range(N - 1, N - 1 - maxv, -1):
    A[N - 1 - maxv] += A[i]
    A[i] = 0
    
ans = []
for i in range(N):
    ans.append(A[minv - now + i])
print(*ans)
0