結果
| 問題 | 
                            No.702 中央値を求めよ LIMITED
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kobaya0514
                         | 
                    
| 提出日時 | 2018-06-16 00:30:03 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 591 bytes | 
| コンパイル時間 | 149 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-06-30 15:43:46 | 
| 合計ジャッジ時間 | 1,782 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 2 | 
| other | RE * 25 | 
ソースコード
import heapq
right=[]
left=[]
heapq.heapify(right)
heapq.heapify(left)
root=int(input())
for i in range(1,10000001):
  if i%2==1:
    a=int(input())
  else:
    b=int(input())
    if root<min(a,b):
      heapq.heappush(left,-root)
      heapq.heappush(right,a)
      heapq.heappush(right,b)
      root=heapq.heappop(right)
    elif min(a,b)< root < max(a,b):
      heapq.heappush(left,-(min(a,b)))
      heapq.heappush(right,max(a,b))
    else:
      heapq.heappush(right,root)
      heapq.heappush(left,-a)
      heapq.heappush(left,-b)
      root=heapq.heappop(left)*-1
print(root)
            
            
            
        
            
kobaya0514