結果
| 問題 | No.59 鉄道の旅 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-28 16:17:46 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 520 bytes |
| 記録 | |
| コンパイル時間 | 449 ms |
| コンパイル使用メモリ | 80,896 KB |
| 実行使用メモリ | 81,152 KB |
| 最終ジャッジ日時 | 2026-05-30 17:03:17 |
| 合計ジャッジ時間 | 8,421 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | TLE * 1 -- * 11 |
ソースコード
N, K = map(int, raw_input().split())
nimotsu = {}
for _ in xrange(N):
query = int(raw_input())
if query > 0:
if sum(v for k,v in nimotsu.items() if k >= query) < K:
if query in nimotsu:
nimotsu[query] += 1
else:
nimotsu[query] = 1
else:
query *= -1
if query in nimotsu:
if nimotsu[query] == 1:
del nimotsu[query]
else:
nimotsu[query] -= 1
print sum(nimotsu.values())