답안 #1038309

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1038309 2024-07-29T16:09:38 Z vjudge1 Colors (BOI20_colors) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(ll i=a,isudgh=b;i<isudgh;i++)
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define imp(v) {for(auto jhglkdfjg:v)cout<<jhglkdfjg<<" ";cout<<"\n";}
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;

set<ll>st;
ll ask(ll c){
	assert(!st.count(c));
	st.insert(c);
	cout<<"? "<<c+1<<endl;
	ll ret; cin>>ret;
	return ret;
}

int main(){FIN;
	ll n; cin>>n;
	ask(0);
	ll col=0,res=-1;
	for(ll i=n-1;i>0;i--){
		ll c=col+(i%2==n%2?-i:i);
		if(!ask(c)){
			res=i+1;
			break;
		}
		col=c;
	}
	cout<<"= "<<res<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to -1, violates the range [1, 26]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to -1, violates the range [1, 26]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to -1, violates the range [1, 26]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to -1, violates the range [1, 26]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 0 ms 344 KB OK (6 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to -1, violates the range [1, 26]
5 Halted 0 ms 0 KB -