結果
問題 | No.2252 Find Zero |
ユーザー |
|
提出日時 | 2023-03-24 21:46:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 74 ms / 2,000 ms |
コード長 | 1,515 bytes |
コンパイル時間 | 1,765 ms |
コンパイル使用メモリ | 130,752 KB |
実行使用メモリ | 25,220 KB |
平均クエリ数 | 78.17 |
最終ジャッジ日時 | 2024-09-18 16:57:00 |
合計ジャッジ時間 | 4,033 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <deque> #include <queue> #include <set> #include <map> #include <limits> #include <cmath> #include <iomanip> #include <functional> #include <random> #include <set> #include <atcoder/string> #include <unordered_map> #include <climits> #include <atcoder/lazysegtree> using namespace std; using ll = long long; using namespace atcoder; int solve() { ll N; cin >> N; if (N % 2 == 1) { for (int i = 0; i + 1 < N; i += 2) { cout << "? " << i << " " << i + 1 << endl; ll ret; cin >> ret; if (ret == i) { cout << "! " << i + 1 << endl; return 0; } else if (ret == i + 1) { cout << "! " << i << endl; return 0; } } cout << "! " << N - 1 << endl; } else { for (int i = 0; i < N; i += 2) { cout << "? " << i << " " << i + 1 << endl; ll ret; cin >> ret; if (ret == i) { cout << "! " << i + 1 << endl; return 0; } else if (ret == i + 1) { cout << "! " << i << endl; return 0; } } } return 0; } int main() { // ll T; // cin >> T; // while (T--) // { solve(); // } cout << flush; return 0; }