Submission #1062343

# Submission time Handle Problem Language Result Execution time Memory
1062343 2024-08-17T03:37:02 Z ArthuroWich The Big Prize (IOI17_prize) C++17
0 / 100
58 ms 11352 KB
#include"prize.h"
#include<bits/stdc++.h>
using namespace std;
int ans = -1;
bool check(vector<int> res) {
	return (res[0] == res[1] && res[0] == 0);
}
vector<vector<int>> seg(200005, {-1, -1});
void calc(int l, int r) {
	if (l == r || ans != -1) {
		return;
	}
	int m = (l+r)/2;
	if (seg[l][0] == -1) {
		seg[l] = ask(l);
	}
	if (check(seg[l])) {
		ans = l;
		return;
	}
	if (seg[m][0] == -1) {
		seg[m] = ask(m);
	}
	if (check(seg[m])) {
		ans = m;
		return;
	}
	if (seg[l] != seg[m] || seg[m][0]-seg[l][0] == 0) {
		calc(l, m);
	}
	if (ans != -1) {
		return;
	}
	if (seg[m+1][0] == -1) {
		seg[m+1] = ask(m+1);
	}
	if (check(seg[m+1])) {
		ans = m+1;
		return;
	}
	if (seg[r][0] == -1) {
		seg[r] = ask(r);
	}
	if (check(seg[r])) {
		ans = r;
		return;
	}
	if (seg[m+1] != seg[r] || seg[r][0]-seg[m+1][0] == 0) {
		calc(m+1, r);
	}
}
int find_best(int n) {
	calc(0, n-1);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 11352 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 11352 KB Incorrect
2 Halted 0 ms 0 KB -