結果
| 問題 | No.2252 Find Zero |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2023-07-29 00:09:36 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 656 bytes |
| 記録 | |
| コンパイル時間 | 1,181 ms |
| コンパイル使用メモリ | 211,336 KB |
| 実行使用メモリ | 30,020 KB |
| 平均クエリ数 | 78.17 |
| 最終ジャッジ日時 | 2026-07-01 22:19:49 |
| 合計ジャッジ時間 | 3,351 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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