結果
| 問題 |
No.649 ここでちょっとQK!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-26 11:54:39 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 467 bytes |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 12,800 KB |
| 最終ジャッジ日時 | 2024-11-22 11:05:16 |
| 合計ジャッジ時間 | 18,828 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 32 |
ソースコード
#yuki649 import heapq q,k=map(int,raw_input().split()) que1=[] que2=[] print '--------------' 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)