結果
| 問題 | No.649 ここでちょっとQK! |
| コンテスト | |
| ユーザー |
tktk_snsn
|
| 提出日時 | 2020-07-15 20:22:40 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 373 ms / 3,000 ms |
| + 650µs | |
| コード長 | 538 bytes |
| 記録 | |
| コンパイル時間 | 60 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2026-10-12 20:00:45 |
| 合計ジャッジ時間 | 9,118 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
import sys
import heapq
input = sys.stdin.readline
Q, K = map(int, input().split())
low = []
high = []
for _ in range(Q):
query = list(map(int, input().split()))
if len(query) == 2:
heapq.heappush(low, -query[1])
if len(low) > K:
x = -heapq.heappop(low)
heapq.heappush(high, x)
else:
if len(low) < K:
print(-1)
else:
print(-heapq.heappop(low))
if high:
x = heapq.heappop(high)
heapq.heappush(low, -x)
tktk_snsn