Submission #1055356

# Submission time Handle Problem Language Result Execution time Memory
1055356 2024-08-12T18:03:32 Z phoenix The Big Prize (IOI17_prize) C++17
0 / 100
48 ms 5696 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 200200;

vector<int> arr[N];

vector<int> ASK(int p) {
	if (arr[p].empty())
		arr[p] = ask(p);
	return arr[p];	
}

int find_best(int n) {
	int i = 0;
	while (i < n) {
		int x = ASK(i)[0] + ASK(i)[1];
		if (!x) 
			return i;
		
		if (x <= 20)
			i++;
		else {
			int l = i, r = n;
			while (r - l > 1) {
				int m = (l + r) / 2;
				if (ASK(m) == ASK(l))
					l = m;
				else {
					if (ASK(m)[0] + ASK(m)[1] == 0) 
						return m;
					r = m;
				} 
			}
			i = r;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 5696 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 5668 KB Incorrect
2 Halted 0 ms 0 KB -