結果
問題 | No.1830 Balanced Majority |
ユーザー | mink1618033 |
提出日時 | 2022-02-04 22:27:35 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 781 bytes |
コンパイル時間 | 1,010 ms |
コンパイル使用メモリ | 87,060 KB |
実行使用メモリ | 89,404 KB |
平均クエリ数 | 7.54 |
最終ジャッジ日時 | 2023-09-02 05:05:36 |
合計ジャッジ時間 | 5,078 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge16 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 94 ms
87,372 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 98 ms
89,180 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 98 ms
87,428 KB |
testcase_21 | AC | 101 ms
89,092 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 104 ms
88,328 KB |
testcase_25 | AC | 99 ms
87,684 KB |
ソースコード
import sys n = int(input()) li = [-1]*n now=1 print("? ",now,flush=True) q = int(input()) cri = q*2-now li[now-1]=cri a=cri now=n-1 print("? ",now,flush=True) q = int(input()) cri = q*2-now li[now-1]=cri b=cri if a*b>0: print("!",1,n-1,flush=True) sys.exit() #a*b<0 l=1 r=n-1 for i in range(18): lv=li[l-1] rv=li[r-1] mid = (l+r)//2 now=mid print("? ",now,flush=True) q = int(input()) cri = q*2-now li[now-1]=cri if cri==0: if mid<=n//2: print("!",mid,n,flush=True) else: print("!",1,mid,flush=True) sys.exit() elif cri>0: if lv>0: l=mid else: r=mid else: #cri<0 if lv<0: l=mid else: r=mid