結果
| 問題 | No.2921 Seated in Classroom | 
| コンテスト | |
| ユーザー |  timi | 
| 提出日時 | 2024-10-12 14:43:49 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 223 ms / 2,000 ms | 
| コード長 | 499 bytes | 
| コンパイル時間 | 206 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 77,028 KB | 
| 最終ジャッジ日時 | 2024-10-12 14:43:52 | 
| 合計ジャッジ時間 | 2,358 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 | 
ソースコード
import heapq 
from heapq import heappop,heappush,heapify
from sys import stdin, setrecursionlimit
input = stdin.readline
readline = stdin.readline
from collections import deque
d=deque()
T=int(input())
for i in range(T):
  N,M=map(int,input().split())
  ng,ok=0,10**9
  while ok-ng>1:
    mid=(ok+ng)//2 
    f=1
    t=8*mid 
    if 4*mid<N:
      f=0 
    p=t-N 
    if p<M:
      f=0 
    if f==0:
      ng=mid 
    else:
      ok=mid 
  print(ok)
    
#A=list(map(int, input().split()))
            
            
            
        