結果

問題 No.59 鉄道の旅
ユーザー szkhtsszkhts
提出日時 2024-03-17 07:57:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 402 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 17,428 KB
最終ジャッジ日時 2024-03-17 07:57:43
合計ジャッジ時間 10,284 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
10,752 KB
testcase_01 AC 75 ms
10,752 KB
testcase_02 AC 110 ms
10,752 KB
testcase_03 AC 437 ms
10,752 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
weights = [0] * 100001
ans = 0

for i in range(n):
    w = int(input())
    tmp = 0
    if w < 0:
        if weights[abs(w)] > 0:
            weights[abs(w)] -= 1
    else:
        for j in range(w, len(weights)):
            tmp += weights[j]
        if tmp < k:
            weights[w] += 1
        
for i in range(len(weights)):
    ans += weights[i]
    
print(ans)
0