結果

問題 No.649 ここでちょっとQK!
ユーザー 💕💖💞💕💖💞
提出日時 2018-11-22 17:49:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 878 ms / 3,000 ms
コード長 345 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 16,180 KB
最終ジャッジ日時 2023-08-26 03:55:15
合計ジャッジ時間 13,432 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,048 KB
testcase_01 AC 13 ms
8,028 KB
testcase_02 AC 13 ms
8,084 KB
testcase_03 AC 878 ms
7,940 KB
testcase_04 AC 692 ms
16,052 KB
testcase_05 AC 712 ms
16,172 KB
testcase_06 AC 628 ms
16,180 KB
testcase_07 AC 14 ms
7,996 KB
testcase_08 AC 13 ms
7,940 KB
testcase_09 AC 15 ms
8,020 KB
testcase_10 AC 15 ms
8,096 KB
testcase_11 AC 14 ms
7,940 KB
testcase_12 AC 362 ms
11,504 KB
testcase_13 AC 351 ms
11,264 KB
testcase_14 AC 371 ms
11,396 KB
testcase_15 AC 374 ms
11,472 KB
testcase_16 AC 334 ms
11,548 KB
testcase_17 AC 395 ms
12,016 KB
testcase_18 AC 428 ms
12,328 KB
testcase_19 AC 499 ms
12,720 KB
testcase_20 AC 514 ms
12,688 KB
testcase_21 AC 558 ms
13,164 KB
testcase_22 AC 594 ms
13,324 KB
testcase_23 AC 635 ms
13,972 KB
testcase_24 AC 683 ms
14,056 KB
testcase_25 AC 734 ms
14,456 KB
testcase_26 AC 774 ms
14,884 KB
testcase_27 AC 17 ms
7,956 KB
testcase_28 AC 17 ms
8,036 KB
testcase_29 AC 17 ms
8,100 KB
testcase_30 AC 371 ms
11,508 KB
testcase_31 AC 353 ms
11,648 KB
testcase_32 AC 14 ms
7,940 KB
testcase_33 AC 14 ms
8,016 KB
testcase_34 AC 14 ms
8,052 KB
testcase_35 AC 15 ms
7,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
Q, K = map(int, input().split())

s = []
low = []
high = []
for q in range(Q):
  line = input().strip()
  if line[0] == '1':
    _, val = map(int, line.split())
    heapq.heappush(low, -val)
    if len(low) == K:
      heapq.heappush(high, -heapq.heappop(low))
  if line[0] == '2':
    print(-1 if not high else heapq.heappop(high))
0