結果
| 問題 | 
                            No.1830 Balanced Majority
                             | 
                    
| コンテスト | |
| ユーザー | 
                             titia
                         | 
                    
| 提出日時 | 2022-02-06 00:39:09 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 607 bytes | 
| コンパイル時間 | 188 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 27,736 KB | 
| 平均クエリ数 | 8.88 | 
| 最終ジャッジ日時 | 2024-06-11 13:41:58 | 
| 合計ジャッジ時間 | 2,658 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 20 RE * 5 | 
ソースコード
import sys
input = sys.stdin.readline
N=int(input())
print("?",1,flush=True)
x=int(input())
print("?",N-1,flush=True)
y=int(input())
if x==1 and y==N//2:
    print("!",2,N-1,flush=True)
    exit()
elif x==0 and y==N//2-1:
    print("!",2,N-1,flush=True)
    exit()
# 1~xの表 - 裏の枚数が0になるものを探す
MIN=2
MAX=N-1
while True:
    mid=(MIN+MAX)//2
    print("?",mid,flush=True)
    x=int(input())
    y=mid-x
    if x<y:
        MAX=mid
    elif x>y:
        MIN=mid
    else:
        break
if mid>=N//2:
    print("!",1,mid,flush=True)
else:
    print("!",mid+1,N,flush=True)
            
            
            
        
            
titia