Submission #758452

# Submission time Handle Problem Language Result Execution time Memory
758452 2023-06-14T16:02:43 Z Andrey The Big Prize (IOI17_prize) C++14
90 / 100
94 ms 336 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;

int find_best(int n) {
	int y = 0,l,r,m,x,big = 0,z;
	for(int i = 0; i*i < n; i++) {
        vector<int> a = ask(i);
        if(a[0] == 0 && a[1] == 0) {
            return i;
        }
        if(a[0]+a[1] > big) {
            big = a[0]+a[1];
            y = i+1;
        }
	}
	while(y < n) {
        l = y;
        r = n-1;
        vector<int> a = ask(y);
        x = a[0];
        z = a[1];
        while(l < r) {
            m = (l+r+1)/2;
            a = ask(m);
            if(a[0] == x && a[1] == z) {
                l = m;
            }
            else {
                r = m-1;
            }
        }
        a = ask(l+1);
        if(a[0] == 0 && a[1] == 0) {
            return l+1;
        }
        y = l+2;
	}
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 3 ms 292 KB Output is correct
3 Correct 3 ms 336 KB Output is correct
4 Correct 5 ms 292 KB Output is correct
5 Correct 3 ms 292 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
8 Correct 6 ms 292 KB Output is correct
9 Correct 3 ms 292 KB Output is correct
10 Correct 6 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 5 ms 296 KB Output is correct
3 Correct 4 ms 288 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 1 ms 292 KB Output is correct
7 Correct 2 ms 292 KB Output is correct
8 Correct 3 ms 288 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 7 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 11 ms 208 KB Output is correct
14 Correct 5 ms 208 KB Output is correct
15 Correct 15 ms 268 KB Output is correct
16 Partially correct 73 ms 208 KB Partially correct - number of queries: 7782
17 Correct 2 ms 276 KB Output is correct
18 Partially correct 89 ms 296 KB Partially correct - number of queries: 9058
19 Correct 3 ms 292 KB Output is correct
20 Correct 28 ms 208 KB Output is correct
21 Correct 30 ms 292 KB Output is correct
22 Correct 10 ms 272 KB Output is correct
23 Correct 2 ms 296 KB Output is correct
24 Correct 4 ms 208 KB Output is correct
25 Partially correct 38 ms 208 KB Partially correct - number of queries: 5337
26 Partially correct 57 ms 208 KB Partially correct - number of queries: 5292
27 Correct 4 ms 296 KB Output is correct
28 Partially correct 52 ms 336 KB Partially correct - number of queries: 8651
29 Partially correct 49 ms 208 KB Partially correct - number of queries: 6672
30 Partially correct 77 ms 208 KB Partially correct - number of queries: 8999
31 Correct 7 ms 208 KB Output is correct
32 Correct 9 ms 296 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 31 ms 208 KB Output is correct
35 Correct 7 ms 208 KB Output is correct
36 Correct 21 ms 292 KB Output is correct
37 Correct 4 ms 208 KB Output is correct
38 Correct 5 ms 208 KB Output is correct
39 Correct 24 ms 208 KB Output is correct
40 Partially correct 70 ms 208 KB Partially correct - number of queries: 7755
41 Partially correct 60 ms 208 KB Partially correct - number of queries: 5596
42 Partially correct 44 ms 208 KB Partially correct - number of queries: 5596
43 Partially correct 72 ms 208 KB Partially correct - number of queries: 5097
44 Correct 45 ms 292 KB Output is correct
45 Correct 32 ms 208 KB Output is correct
46 Correct 6 ms 208 KB Output is correct
47 Correct 46 ms 292 KB Output is correct
48 Partially correct 35 ms 288 KB Partially correct - number of queries: 6814
49 Correct 9 ms 208 KB Output is correct
50 Partially correct 66 ms 296 KB Partially correct - number of queries: 9055
51 Correct 37 ms 292 KB Output is correct
52 Correct 6 ms 208 KB Output is correct
53 Correct 4 ms 276 KB Output is correct
54 Correct 41 ms 208 KB Output is correct
55 Correct 4 ms 288 KB Output is correct
56 Partially correct 70 ms 208 KB Partially correct - number of queries: 9057
57 Partially correct 57 ms 208 KB Partially correct - number of queries: 6736
58 Partially correct 50 ms 336 KB Partially correct - number of queries: 6842
59 Partially correct 41 ms 208 KB Partially correct - number of queries: 5596
60 Partially correct 20 ms 292 KB Partially correct - number of queries: 5228
61 Correct 4 ms 288 KB Output is correct
62 Correct 6 ms 208 KB Output is correct
63 Correct 7 ms 208 KB Output is correct
64 Correct 6 ms 208 KB Output is correct
65 Correct 6 ms 208 KB Output is correct
66 Correct 8 ms 288 KB Output is correct
67 Correct 6 ms 208 KB Output is correct
68 Correct 5 ms 284 KB Output is correct
69 Correct 3 ms 208 KB Output is correct
70 Correct 5 ms 208 KB Output is correct
71 Partially correct 88 ms 208 KB Partially correct - number of queries: 9183
72 Correct 9 ms 208 KB Output is correct
73 Partially correct 76 ms 208 KB Partially correct - number of queries: 9050
74 Partially correct 54 ms 208 KB Partially correct - number of queries: 9126
75 Correct 6 ms 208 KB Output is correct
76 Partially correct 68 ms 208 KB Partially correct - number of queries: 7886
77 Partially correct 64 ms 208 KB Partially correct - number of queries: 9051
78 Correct 11 ms 208 KB Output is correct
79 Correct 47 ms 292 KB Output is correct
80 Partially correct 94 ms 292 KB Partially correct - number of queries: 9085
81 Partially correct 74 ms 288 KB Partially correct - number of queries: 9077
82 Partially correct 78 ms 208 KB Partially correct - number of queries: 8992
83 Correct 7 ms 208 KB Output is correct
84 Partially correct 47 ms 208 KB Partially correct - number of queries: 7516
85 Partially correct 69 ms 292 KB Partially correct - number of queries: 9066
86 Correct 9 ms 208 KB Output is correct
87 Correct 4 ms 208 KB Output is correct
88 Correct 5 ms 208 KB Output is correct
89 Correct 5 ms 208 KB Output is correct
90 Correct 6 ms 208 KB Output is correct
91 Correct 5 ms 208 KB Output is correct
92 Correct 7 ms 208 KB Output is correct
93 Correct 11 ms 208 KB Output is correct
94 Correct 10 ms 208 KB Output is correct
95 Correct 8 ms 208 KB Output is correct
96 Correct 8 ms 208 KB Output is correct
97 Correct 4 ms 208 KB Output is correct