Submission #64605

# Submission time Handle Problem Language Result Execution time Memory
64605 2018-08-05T03:24:32 Z nvmdava The Big Prize (IOI17_prize) C++17
0 / 100
9 ms 5300 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
 
 
vector<int> ans[210000];
int mx = -1, s = -1, L, R;

void find(int l, int r){
	if(s != -1 || r < L || l > R){
		return;
	}
	int m = (l + r) >> 1;
	ans[m] = ask(m);
	if(ans[m][0] == 0){
		if(ans[m][1] == 0){
			s = m;
			return;
		}
		L = m + 1;
	}
	if(ans[m][1] == 0){
		R = m - 1;
	}
	if(ans[m][0] == ans[l][0]){
		find(m, r);
	} else if(ans[m][1] == ans[r][1]){
		find(l, m);
	}
}

int find_best(int n) {
	L = 0;
	R = n - 1;
	ans[0] = ask(0);
	ans[n - 1] = ask(n - 1);
	
	if(ans[0][0] + ans[0][1] == 0){
		return 0;
	}
	
	if(ans[n - 1][0] + ans[n - 1][1] == 0){
		return n - 1;
	}
	find(0, n - 1);
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 5240 KB answer is not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 5300 KB answer is not correct
2 Halted 0 ms 0 KB -