結果
| 問題 |
No.2252 Find Zero
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2023-07-29 00:09:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 656 bytes |
| コンパイル時間 | 1,731 ms |
| コンパイル使用メモリ | 194,304 KB |
| 最終ジャッジ日時 | 2025-02-15 20:46:44 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#define _GLIBCXX_DEBUG
#else
#define Debug(...) void(0)
#endif
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
int Query(int x, int y) {
printf("? %d %d\n", x, y);
fflush(stdout);
int z;
cin >> z;
return z;
}
int main() {
int n;
cin >> n;
vector<bool> a(n, false);
rep(i, n / 2) {
if (a[i]) continue;
int z = Query(2 * i, 2 * i + 1);
if (z == 2 * i || z == 2 * i + 1) {
printf("! %d\n", z ^ 1);
fflush(stdout);
return 0;
}
}
printf("! %d\n", n - 1);
fflush(stdout);
return 0;
}
a01sa01to