結果

問題 No.2252 Find Zero
ユーザー achapi
提出日時 2023-03-24 21:56:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,286 bytes
コンパイル時間 4,626 ms
コンパイル使用メモリ 259,844 KB
最終ジャッジ日時 2025-02-11 17:16:29
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 11
権限があれば一括ダウンロードができます

ソースコード

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;
	map<int,int> m;
	for(int i=0;i<n;i++){
		vector<int> a(n);
		vector<int> b(n);
		for(int j=0;j<n;j++){
			a[(i+j)%n]=j;
			b[j]=(i+j)%n;
		}
		int p=0;
		for(int i=0;i<n-1;i+=2){
			p+=b[(a[i]+a[i+1])%n];
		}
		m[p]=i;
	}
	int x=0;
	for(int i=0;i<n-1;i+=2){
		cout<<"? "<<i<<" "<<i+1<<endl;
		int c;cin>>c;
		x+=c;
	}
	cout<<"! "<<m[x]<<endl;
}
0