結果

問題 No.1021 Children in Classrooms
ユーザー rlangevinrlangevin
提出日時 2023-01-21 16:24:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 116,056 KB
最終ジャッジ日時 2023-09-06 05:12:10
合計ジャッジ時間 4,922 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
74,436 KB
testcase_01 AC 77 ms
74,528 KB
testcase_02 AC 73 ms
74,280 KB
testcase_03 AC 90 ms
80,124 KB
testcase_04 AC 92 ms
80,060 KB
testcase_05 AC 92 ms
80,084 KB
testcase_06 AC 94 ms
79,948 KB
testcase_07 AC 96 ms
80,240 KB
testcase_08 WA -
testcase_09 AC 181 ms
115,728 KB
testcase_10 AC 179 ms
115,676 KB
testcase_11 AC 180 ms
115,836 KB
testcase_12 AC 195 ms
115,984 KB
testcase_13 AC 200 ms
115,860 KB
testcase_14 AC 191 ms
116,056 KB
testcase_15 AC 159 ms
110,480 KB
testcase_16 WA -
testcase_17 AC 161 ms
110,328 KB
testcase_18 WA -
testcase_19 AC 111 ms
89,124 KB
権限があれば一括ダウンロードができます

ソースコード

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 = min(N, max(maxv, val))
    minv = max(-(N), min(minv, val))
    now = min(N - 1, max(0, now))
    
minv = abs(minv)
# print(minv, maxv, val, now)
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