Submission #1062371

# Submission time Handle Problem Language Result Execution time Memory
1062371 2024-08-17T05:04:47 Z Muhammad_Aneeq The Big Prize (IOI17_prize) C++17
20 / 100
2 ms 4952 KB
#include "prize.h"
#include <vector>
using namespace std;
int const N=2e5+10;
bool vis[N]={};
vector<int>val[N];
vector<int> qu(int i)
{
	if (vis[i])
		return val[i];
	vis[i]=1;
	val[i]=ask(i);
	return val[i];
}
int sol(int st,int en)
{
	int mid=(st+en)/2;
	vector<int>g=qu(mid);
	if (st==en)
	{
		if (g[0]||g[1])
			return -1;
		return st;
	}
	int z=0;
	if (g[0])
		z=sol(st,mid);
	else if (g[1])
		z=max(z,sol(mid+1,en));
	else
		z=mid;
	return z;
}
int find_best(int n)
{
	return sol(0,n-1);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4952 KB Output is correct
2 Correct 1 ms 4952 KB Output is correct
3 Correct 1 ms 4952 KB Output is correct
4 Correct 1 ms 4952 KB Output is correct
5 Correct 1 ms 4952 KB Output is correct
6 Correct 2 ms 4952 KB Output is correct
7 Correct 2 ms 4952 KB Output is correct
8 Correct 1 ms 4952 KB Output is correct
9 Correct 1 ms 4952 KB Output is correct
10 Correct 1 ms 4952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4952 KB Output is correct
2 Correct 1 ms 4952 KB Output is correct
3 Correct 2 ms 4952 KB Output is correct
4 Correct 1 ms 4952 KB Output is correct
5 Correct 1 ms 4948 KB Output is correct
6 Correct 1 ms 4952 KB Output is correct
7 Correct 1 ms 4952 KB Output is correct
8 Correct 1 ms 4952 KB Output is correct
9 Correct 2 ms 4952 KB Output is correct
10 Correct 1 ms 4952 KB Output is correct
11 Incorrect 2 ms 4952 KB answer is not correct
12 Halted 0 ms 0 KB -