結果
| 問題 | No.3161 Find Presents | 
| コンテスト | |
| ユーザー |  detteiuu | 
| 提出日時 | 2025-05-23 20:37:50 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 859 bytes | 
| コンパイル時間 | 175 ms | 
| コンパイル使用メモリ | 82,452 KB | 
| 実行使用メモリ | 85,996 KB | 
| 最終ジャッジ日時 | 2025-05-23 20:38:10 | 
| 合計ジャッジ時間 | 10,576 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 1 -- * 79 | 
ソースコード
def question(xl, xr, yl, yr):
    print("?", xl, xr, yl, yr)
    ans = int(input())
    if ans == -1:
        exit()
    return int(input()) == 1
A = []
left = 0
while left <= 10**6 and question(left, 10**6, 0, 10**6):
    l = left
    r = 10**6
    while l+1 < r:
        m = (l+r)//2
        if not question(l, m, 0, 10**6):
            l = m+1
        else:
            r = m
    if not question(l, l, 0, 10**6):
        l += 1
    left2 = 0
    while left2 <= 10**6 and question(l, l, left2, 10**6):
        l2 = left2
        r2 = 10**6
        while l2+1 < r2:
            m = (l2+r2)//2
            if not question(l, l, l2, m):
                l2 = m+1
            else:
                r2 = m
        if not question(l, l, l2, l2):
            l2 += 1
        A.append((l, l2))
        left2 = l2+1
print("!", len(A))
for X, Y in A:
    print(X, Y)
            
            
            
        