結果

問題 No.2252 Find Zero
ユーザー achapi
提出日時 2023-03-24 22:06:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,227 bytes
コンパイル時間 3,650 ms
コンパイル使用メモリ 256,200 KB
最終ジャッジ日時 2025-02-11 17:20:23
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//using mint = modint998244353;
//using mint = modint1000000007;
#define all(...) begin(__VA_ARGS__), end(__VA_ARGS__)
#ifdef LOCAL
#  include <debug_print.hpp>
#  define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#  define debug(...) (static_cast<void>(0))
#endif
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
//using Graph=vector<vector<int>>;
/*
struct Edge{int to;ll cost;};
using Graph=vector<vector<Edge>>;
using Pair=pair<ll,int>;
*/
const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main() {
	int n;cin>>n;
	int c=0;
	set<int> a;
	a.insert(c);
	for(int i=0;i<n/2;i++){
		cout<<"? "<<c<<" "<<c<<endl;
		int p;cin>>p;
		a.insert(p);
		if(c==p){
			cout<<"! "<<c<<endl;
			return 0;
		}
		c=p;
	}
	for(int i=0;i<n;i++){
		if(find(all(a),i)==a.end()){
			cout<<"! "<<i<<endl;
			return 0;
		}
	}
}
0