結果

問題 No.649 ここでちょっとQK!
ユーザー pluto77pluto77
提出日時 2018-02-26 11:55:40
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,469 ms / 3,000 ms
コード長 444 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-05-02 01:42:07
合計ジャッジ時間 16,854 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,528 KB
testcase_01 AC 12 ms
6,528 KB
testcase_02 AC 11 ms
6,400 KB
testcase_03 AC 474 ms
6,656 KB
testcase_04 AC 1,469 ms
12,800 KB
testcase_05 AC 711 ms
12,800 KB
testcase_06 AC 615 ms
12,800 KB
testcase_07 AC 12 ms
6,528 KB
testcase_08 AC 11 ms
6,528 KB
testcase_09 AC 11 ms
6,400 KB
testcase_10 AC 10 ms
6,528 KB
testcase_11 AC 11 ms
6,400 KB
testcase_12 AC 408 ms
8,960 KB
testcase_13 AC 383 ms
8,960 KB
testcase_14 AC 394 ms
8,832 KB
testcase_15 AC 484 ms
9,088 KB
testcase_16 AC 394 ms
9,216 KB
testcase_17 AC 573 ms
9,344 KB
testcase_18 AC 647 ms
9,600 KB
testcase_19 AC 719 ms
9,856 KB
testcase_20 AC 806 ms
10,240 KB
testcase_21 AC 853 ms
10,496 KB
testcase_22 AC 912 ms
10,752 KB
testcase_23 AC 1,022 ms
11,008 KB
testcase_24 AC 1,064 ms
11,264 KB
testcase_25 AC 1,094 ms
11,520 KB
testcase_26 AC 1,137 ms
11,776 KB
testcase_27 AC 14 ms
6,528 KB
testcase_28 AC 15 ms
6,528 KB
testcase_29 AC 15 ms
6,528 KB
testcase_30 AC 435 ms
8,960 KB
testcase_31 AC 516 ms
9,216 KB
testcase_32 AC 11 ms
6,528 KB
testcase_33 AC 10 ms
6,528 KB
testcase_34 AC 11 ms
6,400 KB
testcase_35 AC 11 ms
6,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki649
import heapq


q,k=map(int,raw_input().split())
que1=[]
que2=[]
for i in xrange(q):
 s=map(int,raw_input().split())
 if len(s)==2:
  v=s[1]
  if len(que1)<k:
   heapq.heappush(que1,-v)
  elif v<-que1[0]:
   heapq.heappush(que2,-heapq.heappushpop(que1,-v))
  else:
   heapq.heappush(que2,v)
 else:
  if len(que1)<k:
   print '-1'
  elif que2:
   print -heapq.heapreplace(que1,-heapq.heappop(que2))
  else:
   print -heapq.heappop(que1)
0