結果
問題 | No.2252 Find Zero |
ユーザー | yupooh |
提出日時 | 2023-03-24 21:36:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 131 ms / 2,000 ms |
コード長 | 667 bytes |
コンパイル時間 | 164 ms |
コンパイル使用メモリ | 81,736 KB |
実行使用メモリ | 78,464 KB |
平均クエリ数 | 78.17 |
最終ジャッジ日時 | 2023-10-18 20:51:39 |
合計ジャッジ時間 | 3,111 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 102 ms
69,912 KB |
testcase_01 | AC | 131 ms
78,464 KB |
testcase_02 | AC | 87 ms
69,912 KB |
testcase_03 | AC | 105 ms
69,912 KB |
testcase_04 | AC | 89 ms
69,920 KB |
testcase_05 | AC | 88 ms
69,920 KB |
testcase_06 | AC | 88 ms
69,920 KB |
testcase_07 | AC | 89 ms
69,920 KB |
testcase_08 | AC | 102 ms
69,912 KB |
testcase_09 | AC | 112 ms
75,492 KB |
testcase_10 | AC | 88 ms
69,920 KB |
testcase_11 | AC | 88 ms
69,920 KB |
testcase_12 | AC | 88 ms
69,920 KB |
testcase_13 | AC | 89 ms
69,920 KB |
testcase_14 | AC | 90 ms
69,920 KB |
testcase_15 | AC | 90 ms
69,920 KB |
testcase_16 | AC | 89 ms
69,920 KB |
testcase_17 | AC | 89 ms
69,920 KB |
ソースコード
import sys input = sys.stdin.readline n=int(input()) if n%2==0: for i in range(n//2-1): print("?",i*2,i*2+1,flush=True) z=int(input()) if z==i*2: print("!",i*2+1,flush=True) exit() elif z==i*2+1: print("!",i*2,flush=True) exit() x=(n//2-2)*2+2 print("?",x,x-1,flush=True) z=int(input()) if z==x-1: print("!",x,flush=True) else: print("!",x+1,flush=True) else: for i in range(n//2): print("?",i*2,i*2+1,flush=True) z=int(input()) if z==i*2: print("!",i*2+1,flush=True) exit() elif z==i*2+1: print("!",i*2,flush=True) exit() x=(n//2-1)*2+2 print("!",x,flush=True)