Submission #1029124

# Submission time Handle Problem Language Result Execution time Memory
1029124 2024-07-20T12:50:30 Z amirhoseinfar1385 The Big Prize (IOI17_prize) C++17
20 / 100
701 ms 1048576 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
map<int,pair<int,int>>mp;

pair<int,int>pors(int u){
	if(mp.count(u)==0){
		vector<int>hey=ask(u);
		mp[u]=make_pair(hey[0],hey[1]);
	}
	return mp[u];
}
int mainres=-1;

void solve(int l,int r){
	if(mainres!=-1){
		return ;
	}
	int mid=(l+r)>>1;
	pair<int,int>fake=pors(mid);
	if(fake.first==fake.second&&fake.first==0){
		mainres=mid;
		return ;
	}
	if(fake.second!=0){
		solve(mid+1,r);
	}
	if(fake.first!=0){
		solve(l,mid-1);
	}
}

int find_best(int n) {
	solve(0,n-1);
	return mainres;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 504 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Runtime error 701 ms 1048576 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -