結果
問題 |
No.1830 Balanced Majority
|
ユーザー |
👑 ![]() |
提出日時 | 2022-02-04 21:38:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 605 bytes |
コンパイル時間 | 553 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 69,216 KB |
平均クエリ数 | 11.15 |
最終ジャッジ日時 | 2024-06-11 11:36:15 |
合計ジャッジ時間 | 3,536 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 12 WA * 13 |
ソースコード
""" 0 110 0 011 """ import sys from sys import stdin def ask(i): print ("?",i,flush=True) cat = int(stdin.readline()) return cat N = int(stdin.readline()) one = ask(1) two = ask(2) a1 = one a2 = two-one if a1 != a2: print ("!",1,2,flush=True) sys.exit() l = 2 r = N while r-l != 1: m = (l+r)//2 get = ask(m) x = get-a1 #one y = (m-1)-x #zero #print (m,x,y) if a2 == 1: if x <= y: r = m else: l = m else: if x >= y: r = m else: l = m print ("!",2,r,flush=True)