Submission #113523

# Submission time Handle Problem Language Result Execution time Memory
113523 2019-05-26T06:36:22 Z E869120 The Big Prize (IOI17_prize) C++14
20 / 100
114 ms 2204 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 < 18; 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;
	}
	//for (int i = 0; i < T.size(); i++) cout << T[i] << ", "; cout << endl;
	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 2028 KB Output is correct
2 Correct 5 ms 2036 KB Output is correct
3 Correct 4 ms 2060 KB Output is correct
4 Correct 20 ms 2028 KB Output is correct
5 Correct 5 ms 2156 KB Output is correct
6 Correct 5 ms 2028 KB Output is correct
7 Correct 4 ms 1968 KB Output is correct
8 Correct 4 ms 2028 KB Output is correct
9 Correct 4 ms 1968 KB Output is correct
10 Correct 4 ms 2036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2156 KB Output is correct
2 Correct 5 ms 2040 KB Output is correct
3 Correct 4 ms 1960 KB Output is correct
4 Correct 4 ms 2036 KB Output is correct
5 Correct 4 ms 2028 KB Output is correct
6 Correct 4 ms 2036 KB Output is correct
7 Correct 4 ms 2036 KB Output is correct
8 Correct 4 ms 2028 KB Output is correct
9 Correct 4 ms 2052 KB Output is correct
10 Correct 4 ms 2036 KB Output is correct
11 Correct 11 ms 2036 KB Output is correct
12 Correct 9 ms 1900 KB Output is correct
13 Correct 14 ms 2036 KB Output is correct
14 Correct 28 ms 512 KB Output is correct
15 Partially correct 63 ms 2036 KB Partially correct - number of queries: 8574
16 Partially correct 95 ms 2028 KB Partially correct - number of queries: 9573
17 Partially correct 96 ms 1900 KB Partially correct - number of queries: 9627
18 Partially correct 54 ms 2036 KB Partially correct - number of queries: 9607
19 Partially correct 32 ms 2056 KB Partially correct - number of queries: 8925
20 Partially correct 37 ms 1272 KB Partially correct - number of queries: 6758
21 Partially correct 55 ms 1900 KB Partially correct - number of queries: 9385
22 Partially correct 65 ms 2056 KB Partially correct - number of queries: 6857
23 Correct 6 ms 2036 KB Output is correct
24 Correct 7 ms 2028 KB Output is correct
25 Partially correct 96 ms 2028 KB Partially correct - number of queries: 9664
26 Partially correct 54 ms 2184 KB Partially correct - number of queries: 9520
27 Correct 6 ms 2028 KB Output is correct
28 Partially correct 94 ms 1900 KB Partially correct - number of queries: 9350
29 Partially correct 85 ms 2036 KB Partially correct - number of queries: 7804
30 Partially correct 54 ms 2036 KB Partially correct - number of queries: 9366
31 Partially correct 93 ms 2028 KB Partially correct - number of queries: 9386
32 Correct 14 ms 2056 KB Output is correct
33 Correct 4 ms 384 KB Output is correct
34 Partially correct 80 ms 2028 KB Partially correct - number of queries: 9664
35 Correct 9 ms 1908 KB Output is correct
36 Partially correct 66 ms 2028 KB Partially correct - number of queries: 9441
37 Correct 7 ms 2028 KB Output is correct
38 Correct 7 ms 2028 KB Output is correct
39 Partially correct 37 ms 2028 KB Partially correct - number of queries: 9386
40 Partially correct 41 ms 2028 KB Partially correct - number of queries: 7878
41 Partially correct 64 ms 1900 KB Partially correct - number of queries: 9700
42 Partially correct 114 ms 2028 KB Partially correct - number of queries: 9700
43 Partially correct 82 ms 2028 KB Partially correct - number of queries: 9377
44 Partially correct 40 ms 1908 KB Partially correct - number of queries: 9646
45 Partially correct 44 ms 1960 KB Partially correct - number of queries: 9664
46 Partially correct 51 ms 2032 KB Partially correct - number of queries: 9592
47 Partially correct 34 ms 2072 KB Partially correct - number of queries: 9555
48 Partially correct 105 ms 1900 KB Partially correct - number of queries: 9664
49 Partially correct 83 ms 1900 KB Partially correct - number of queries: 9628
50 Partially correct 39 ms 2156 KB Partially correct - number of queries: 9607
51 Partially correct 108 ms 1992 KB Partially correct - number of queries: 9664
52 Partially correct 103 ms 2028 KB Partially correct - number of queries: 9627
53 Correct 5 ms 2028 KB Output is correct
54 Partially correct 70 ms 2204 KB Partially correct - number of queries: 9422
55 Partially correct 76 ms 1900 KB Partially correct - number of queries: 9646
56 Partially correct 35 ms 2156 KB Partially correct - number of queries: 9625
57 Partially correct 34 ms 2028 KB Partially correct - number of queries: 9404
58 Partially correct 68 ms 2036 KB Partially correct - number of queries: 9645
59 Partially correct 47 ms 2028 KB Partially correct - number of queries: 9700
60 Partially correct 77 ms 1900 KB Partially correct - number of queries: 9422
61 Correct 6 ms 2036 KB Output is correct
62 Correct 5 ms 2028 KB Output is correct
63 Correct 6 ms 2028 KB Output is correct
64 Correct 5 ms 2048 KB Output is correct
65 Correct 5 ms 2036 KB Output is correct
66 Correct 11 ms 2028 KB Output is correct
67 Correct 9 ms 2064 KB Output is correct
68 Correct 7 ms 2056 KB Output is correct
69 Correct 12 ms 1900 KB Output is correct
70 Correct 9 ms 1908 KB Output is correct
71 Partially correct 81 ms 2036 KB Partially correct - number of queries: 9102
72 Correct 13 ms 1952 KB Output is correct
73 Partially correct 55 ms 2036 KB Partially correct - number of queries: 8964
74 Partially correct 65 ms 2036 KB Partially correct - number of queries: 8987
75 Correct 6 ms 1936 KB Output is correct
76 Partially correct 54 ms 2036 KB Partially correct - number of queries: 7692
77 Partially correct 34 ms 2036 KB Partially correct - number of queries: 9588
78 Correct 12 ms 1908 KB Output is correct
79 Correct 27 ms 1908 KB Output is correct
80 Partially correct 56 ms 1908 KB Partially correct - number of queries: 9624
81 Partially correct 35 ms 2084 KB Partially correct - number of queries: 9606
82 Partially correct 53 ms 2036 KB Partially correct - number of queries: 9365
83 Correct 5 ms 2036 KB Output is correct
84 Partially correct 38 ms 2036 KB Partially correct - number of queries: 7731
85 Partially correct 64 ms 1908 KB Partially correct - number of queries: 9624
86 Incorrect 67 ms 2036 KB Incorrect
87 Halted 0 ms 0 KB -