結果

問題 No.1021 Children in Classrooms
ユーザー FromBooskaFromBooska
提出日時 2023-02-21 21:53:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 822 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 108,836 KB
最終ジャッジ日時 2023-09-29 12:06:58
合計ジャッジ時間 9,141 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
78,612 KB
testcase_01 AC 68 ms
70,940 KB
testcase_02 AC 69 ms
71,272 KB
testcase_03 AC 100 ms
77,376 KB
testcase_04 AC 97 ms
77,476 KB
testcase_05 AC 113 ms
77,568 KB
testcase_06 AC 108 ms
77,296 KB
testcase_07 AC 207 ms
77,548 KB
testcase_08 AC 162 ms
77,596 KB
testcase_09 AC 1,227 ms
108,444 KB
testcase_10 AC 1,236 ms
108,596 KB
testcase_11 AC 1,231 ms
108,836 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 各クラスがM回後にどこにいるか考えればいい
# これで間に合うのか、もっとスマートな方法が必要なのか

N, M = map(int, input().split())
A = list(map(int, input().split()))
S = input()

level = 0
floor, ceiling = 0, 0
for s in S:
    if s == 'R':
        level += 1
    else:
        level -= 1
    floor = min(floor, level)
    ceiling = max(ceiling, level)

mx_list = []
mn_list = []
for i in range(N):
    mx_list.append(N-1-i)
    mn_list.append(-i)

final = [0]*N

for i in range(N):
    if ceiling <= mx_list[i] and mn_list[i] <= floor:
        final[i+level] += A[i]
    else:
        l = i
        for s in S:
            if s == 'R':
                l = min(l+1, N-1)
            elif s == 'L':
                l = max(l-1, 0)
        final[l] += A[i]

print(*final)




0