Submission #113522

# Submission time Handle Problem Language Result Execution time Memory
113522 2019-05-26T06:28:06 Z E869120 The Big Prize (IOI17_prize) C++14
20 / 100
82 ms 2192 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int A[200009];

vector<int> find_next(vector<int> R) {
	int maxn = 0;
	for (int i = 0; i < 12; i++) {
		vector<int> P = ask(R[rand() % R.size()]);
		maxn = max(maxn, P[0] + P[1]);
	}
	
	int cx = 0; vector<int> T;
	while (cx < R.size()) {
		vector<int> P = ask(R[cx]);
		if (P[0] + P[1] != maxn) { T.push_back(R[cx]); cx++; continue; }
		if (cx + 1 == (int)R.size()) break;
		
		int cl = cx, cr = R.size(), cm, maxn = -1;
		for (int i = 0; i < 20; i++) {
			cm = (cl + cr) / 2;
			vector<int> Q = ask(R[cm]);
			if (P == Q) { cl = cm; maxn = max(maxn, cm); }
			else { cr = cm; }
		}
		if (maxn == (int)R.size() - 1) break;
		T.push_back(R[maxn + 1]);
		cx = maxn + 2;
	}
	return T;
}

int find_best(int n) {
	vector<int> E; for (int i = 0; i < n; i++) E.push_back(i);
	while (E.size() >= 2) E = find_next(E);
	return E[0];
}

Compilation message

prize.cpp: In function 'std::vector<int> find_next(std::vector<int>)':
prize.cpp:15:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (cx < R.size()) {
         ~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2036 KB Output is correct
2 Correct 5 ms 1956 KB Output is correct
3 Correct 5 ms 1900 KB Output is correct
4 Correct 5 ms 1968 KB Output is correct
5 Correct 4 ms 2164 KB Output is correct
6 Correct 5 ms 2164 KB Output is correct
7 Correct 5 ms 1908 KB Output is correct
8 Correct 4 ms 1900 KB Output is correct
9 Correct 5 ms 1900 KB Output is correct
10 Correct 5 ms 2036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2192 KB Output is correct
2 Correct 4 ms 1968 KB Output is correct
3 Correct 4 ms 2028 KB Output is correct
4 Correct 4 ms 2160 KB Output is correct
5 Correct 5 ms 1900 KB Output is correct
6 Correct 4 ms 2156 KB Output is correct
7 Correct 4 ms 2156 KB Output is correct
8 Correct 4 ms 2164 KB Output is correct
9 Correct 5 ms 2048 KB Output is correct
10 Correct 4 ms 1908 KB Output is correct
11 Correct 7 ms 2072 KB Output is correct
12 Correct 12 ms 1900 KB Output is correct
13 Correct 12 ms 2028 KB Output is correct
14 Correct 36 ms 512 KB Output is correct
15 Partially correct 82 ms 2060 KB Partially correct - number of queries: 9474
16 Incorrect 63 ms 1972 KB Incorrect
17 Halted 0 ms 0 KB -