結果
問題 | No.2252 Find Zero |
ユーザー |
|
提出日時 | 2023-03-24 21:27:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 72 ms / 2,000 ms |
コード長 | 520 bytes |
コンパイル時間 | 1,308 ms |
コンパイル使用メモリ | 167,036 KB |
実行使用メモリ | 25,580 KB |
平均クエリ数 | 78.17 |
最終ジャッジ日時 | 2024-09-18 16:43:51 |
合計ジャッジ時間 | 3,287 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for (int i = 0; i < n / 2; i++) { cout << "? " << 2 * i << ' ' << 2 * i + 1 << endl; int z; cin >> z; if (z == 2 * i) { cout << "! " << 2 * i + 1 << endl; return 0; } else if (z == 2 * i + 1) { cout << "! " << 2 * i << endl; return 0; } } cout << "! " << n - 1 << endl; }