Submission #970297

# Submission time Handle Problem Language Result Execution time Memory
970297 2024-04-26T10:27:36 Z maxFedorchuk Colors (BOI20_colors) C++17
0 / 100
1 ms 456 KB
#include <bits/stdc++.h>
using namespace std;

long long zap(long long zn)
{
	cout<<"? "<<zn<<endl;
	cout.flush();

	int rt;
	cin>>rt;
	return rt;
}

void ans(long long zn)
{
	cout<<"= "<<zn<<endl;
	cout.flush();
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	long long n;
	cin>>n;

	long long start=0,zr=0,l=1,r=n,o=-1;
	while(l<r)
	{
		l=(l+r-1)/2;

		zr+=o*l;
		start=max(start,1ll-zr);

		l++;
		o*=-1;
	}

	zap(start);

	l=1,r=n,o=-1;

	while(l<r)
	{
		long long mid=(l+r-1)/2;

		start+=mid*o;
		if(zap(start))
		{
			r=mid;
		}
		else
		{
			l=mid+1;
		}
	}

	ans(l);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -