結果
問題 | No.2252 Find Zero |
ユーザー |
|
提出日時 | 2024-04-09 12:45:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 82 ms / 2,000 ms |
コード長 | 765 bytes |
コンパイル時間 | 4,352 ms |
コンパイル使用メモリ | 250,452 KB |
最終ジャッジ日時 | 2025-02-20 23:20:18 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;using ll = long long;using ld = long double;using mint = modint998244353;int main() {int N, z; cin >> N;if (N % 2 == 0) {for (int i = 0; i < N; i += 2) {cout << "? " << i << ' ' << i + 1 << endl;cin >> z;if (z == i) { cout << "! " << i + 1 << endl; return 0; }if (z == i + 1) { cout << "! " << i << endl; return 0; }}} else {for (int i = 0; i < N - 1; i += 2) {cout << "? " << i << ' ' << i + 1 << endl;cin >> z;if (z == i) { cout << "! " << i + 1 << endl; return 0; }if (z == i + 1) { cout << "! " << i << endl; return 0; }}cout << "! " << N - 1 << endl;};return 0;}