結果
問題 |
No.649 ここでちょっとQK!
|
ユーザー |
![]() |
提出日時 | 2018-08-01 16:00:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 655 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 23,708 KB |
最終ジャッジ日時 | 2024-09-19 16:45:31 |
合計ジャッジ時間 | 6,540 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | AC * 4 TLE * 1 -- * 27 |
ソースコード
q,k = map(int,input().split()) index = k-1 lst = [] def ins(x): l_len=len(lst) if l_len==0: lst.append(x) else: s,t = 0,l_len while True: m=(s+t)//2 if m==l_len: lst.append(x) return elif lst[m]==x or not s<t: lst.insert(m,x) return elif lst[m]<x: s = m+1 else: t = m for i in range(q): s=list(map(int,input().split())) if s[0]==1: ins(s[1]) else: if len(lst)>=k: print(lst.pop(index)) else: print(-1)