結果
| 問題 | No.649 ここでちょっとQK! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-26 11:55:40 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 1,586 ms / 3,000 ms |
| コード長 | 444 bytes |
| コンパイル時間 | 542 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 12,800 KB |
| 最終ジャッジ日時 | 2024-11-22 11:07:59 |
| 合計ジャッジ時間 | 19,426 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#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)