Submission #502482

# Submission time Handle Problem Language Result Execution time Memory
502482 2022-01-06T05:51:03 Z IOI_champion_in_1980 Colors (BOI20_colors) C++14
0 / 100
1 ms 284 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a, b, c, d, e, n, m, l, r, mid, ind, pos;
bool barla(int k)
{
	bool ret;
	cout<<"? "<<k<<endl;
	cin>>ret;
	return ret;
}
int main()
{
    cin>>n;
	l=1; r=n; 
	pos=-1; ind=pos;
	int bir=1;
	while (l<r)
	{
		mid=(l+r)/2;
		ind=ind+(bir*mid);
		pos=min(pos, ind);
		l=mid+1;
		bir=bir*(-1);
	}
	pos=abs(pos);
	barla(pos);
	
	l=1; r=n; bir=1;
	bool hakyky=false;
	while (l<r)
	{
		mid=(l+r-1)/2;
		pos=pos+(bir*mid);
		hakyky=barla(pos);
		if (hakyky) r=mid;
			else l=mid+1;
		bir=bir*(-1);
	}
	cout<<"= "<<l<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (4 queries)
2 Runtime error 1 ms 284 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (4 queries)
2 Runtime error 1 ms 284 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (4 queries)
2 Runtime error 1 ms 284 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (4 queries)
2 Runtime error 1 ms 284 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB OK (4 queries)
2 Runtime error 1 ms 284 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -