結果
問題 | No.59 鉄道の旅 |
ユーザー | szkhts |
提出日時 | 2024-03-17 08:34:15 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 459 bytes |
コンパイル時間 | 243 ms |
コンパイル使用メモリ | 11,776 KB |
実行使用メモリ | 40,020 KB |
最終ジャッジ日時 | 2024-03-17 08:34:24 |
合計ジャッジ時間 | 8,262 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 195 ms
25,596 KB |
testcase_01 | AC | 203 ms
25,596 KB |
testcase_02 | AC | 264 ms
25,596 KB |
testcase_03 | AC | 533 ms
25,588 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
ソースコード
n, k = map(int, input().split()) weights = [0] * 1000001 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: if i < k: weights[w] += 1 else: tmp = sum(weights[w:]) if tmp < k: weights[w] += 1 for i in range(len(weights)): ans += weights[i] print(ans)