Submission #566520

# Submission time Handle Problem Language Result Execution time Memory
566520 2022-05-22T11:26:52 Z Siffer The Big Prize (IOI17_prize) C++14
20 / 100
1 ms 296 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;

int find_best(int n) {
	if(ask(0)[1]==0) return 0;
	vector<int> s, as;
	int a = 1;
	int b = 1;
	while(b <= n) {
		s.push_back(a);
		as.push_back(b);
		a = a*a + 1;
		b += a;
	}
	int k = 0;
	int p = 0; for(; (1<<(p+1)) <= n; p++);
	for(int i = p; ~i; i--) {
		int l = k+(1<<i);
		if(l < n && ask(l)[1]) k = l;
	}
	return k+1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 292 KB Output is correct
8 Correct 1 ms 292 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB answer is not correct
12 Halted 0 ms 0 KB -