結果
問題 |
No.2252 Find Zero
|
ユーザー |
![]() |
提出日時 | 2023-07-29 00:04:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 651 bytes |
コンパイル時間 | 2,076 ms |
コンパイル使用メモリ | 193,660 KB |
最終ジャッジ日時 | 2025-02-15 20:46:18 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 WA * 4 |
ソースコード
#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); int cnt = 0; rep(i, n) { if (a[i]) continue; int z = i; if (cnt != n - 1) z = Query(i, i); if (z == i) { printf("! %d\n", i); fflush(stdout); return 0; } a[i] = a[z] = true; cnt += 2; } return 0; }