Submission #1062330

# Submission time Handle Problem Language Result Execution time Memory
1062330 2024-08-17T03:22:38 Z ArthuroWich The Big Prize (IOI17_prize) C++17
20 / 100
1000 ms 11404 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 (seg[m][0] == -1) {
		seg[m] = ask(m);
	}
	if (check(seg[l])) {
		ans = l;
		return;
	}
	if (check(seg[m])) {
		ans = m;
		return;
	}
	if (seg[l] != seg[m]) {
		calc(l, m);
	}
	if (ans != -1) {
		return;
	}
	if (seg[r][0] == -1) {
		seg[r] = ask(r);
	}
	if (check(seg[r])) {
		ans = r;
		return;
	}
	if (seg[m] != seg[r]) {
		calc(m, r);
	}
}
int find_best(int n) {
	calc(0, n-1);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11352 KB Output is correct
2 Correct 8 ms 11352 KB Output is correct
3 Correct 8 ms 11352 KB Output is correct
4 Correct 7 ms 11352 KB Output is correct
5 Correct 9 ms 11404 KB Output is correct
6 Correct 8 ms 11352 KB Output is correct
7 Correct 8 ms 11352 KB Output is correct
8 Correct 8 ms 11352 KB Output is correct
9 Correct 7 ms 11352 KB Output is correct
10 Correct 8 ms 11352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 11352 KB Output is correct
2 Correct 8 ms 11352 KB Output is correct
3 Correct 10 ms 11348 KB Output is correct
4 Correct 9 ms 11352 KB Output is correct
5 Correct 8 ms 11352 KB Output is correct
6 Correct 9 ms 11352 KB Output is correct
7 Correct 8 ms 11352 KB Output is correct
8 Correct 10 ms 11352 KB Output is correct
9 Correct 8 ms 11388 KB Output is correct
10 Correct 9 ms 11352 KB Output is correct
11 Execution timed out 3041 ms 11352 KB Time limit exceeded
12 Halted 0 ms 0 KB -