Submission #642299

# Submission time Handle Problem Language Result Execution time Memory
642299 2022-09-19T08:13:28 Z tolbi Colors (BOI20_colors) C++17
0 / 100
0 ms 208 KB
#define author tolbi
#pragma optimize("Bismillahirrahmanirrahim")
#include <bits/stdc++.h>
#define int long long
#define vint(x) vector<int> x
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(),x.end())
#define sortrarr(x) sort(x.rbegin(),x.rend())
#define ayahya() chrono::steady_clock().now().time_since_epoch().count()
#define det(x) cout<<"NO\0YES"+x*3<<endl;
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tol(bi) (1LL<<bi)
const int MOD = 1e9+7;
using namespace std;
int ask(int n){
	cout<<"? "<<n<<endl;
	deci(x);
	return x;
}
int32_t main(){
	ios;
	int t=1;
	int tno = 0;
	if (!t) cin>>t;
	while (t-(tno++)){
		deci(n);
		int l = 1, r = n;
		int crr = (n-(l+(r-l)/2)+1)/2+1;
		ask(crr);
		int mv = 0;
		while (l < r){
			int mid = l+(r-l)/2;
			if (mv){
				mid*=-1;
			}
			if (ask(crr+mid)){
				if (mv) r=min(r,-mid);
				else r=min(r,mid);
			}
			else {
				if (mv) l=max(-mid+1,l);
				else l=max(l,mid+1);
			}
			crr+=mid;
			mv^=1;
		}
		cout<<"! "<<l<<endl;
	}
}

Compilation message

Colors.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize("Bismillahirrahmanirrahim")
      |
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -