Submission #771568

# Submission time Handle Problem Language Result Execution time Memory
771568 2023-07-03T06:31:14 Z _martynas The Big Prize (IOI17_prize) C++11
90 / 100
81 ms 336 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

int find_best(int n) {
    mt19937 rng(0);
    int mx_sum = 0;
    for(int k = 0; k < 500; k++) {
        auto v = ask(rng() % n);
        mx_sum = max(mx_sum, v[0]+v[1]);
    }
    for(int i = 0; i < n; i++) {
        auto v = ask(i);
        int sum = v[0]+v[1];
        if(sum == 0) {
            return i;
        }
        if(sum == mx_sum) {
            int l = i, r = n-1;
            while(l < r) {
                int m = (l+r+1)/2;
                auto v_p = ask(m);
                int sum_p = v_p[0]+v_p[1];
                if(sum_p < mx_sum || v_p[0] > v[0]) {
                    r = m-1;
                }
                else {
                    l = m;
                }
            }
            i = l;
        }
    }
	return 0;
}

/*
5
2 2 2 1 2

8
3 3 2 3 3 2 1 3

sample:
8
3 2 3 1 3 3 2 3


*/
# Verdict Execution time Memory Grader output
1 Correct 3 ms 288 KB Output is correct
2 Correct 4 ms 288 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 3 ms 296 KB Output is correct
5 Correct 4 ms 288 KB Output is correct
6 Correct 4 ms 288 KB Output is correct
7 Correct 5 ms 292 KB Output is correct
8 Correct 5 ms 208 KB Output is correct
9 Correct 3 ms 292 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 3 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 2 ms 288 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 2 ms 292 KB Output is correct
8 Correct 2 ms 292 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 2 ms 208 KB Output is correct
11 Correct 3 ms 292 KB Output is correct
12 Correct 5 ms 288 KB Output is correct
13 Correct 9 ms 208 KB Output is correct
14 Correct 6 ms 208 KB Output is correct
15 Correct 6 ms 296 KB Output is correct
16 Partially correct 70 ms 268 KB Partially correct - number of queries: 7833
17 Correct 5 ms 288 KB Output is correct
18 Partially correct 77 ms 284 KB Partially correct - number of queries: 9109
19 Correct 2 ms 292 KB Output is correct
20 Correct 16 ms 208 KB Output is correct
21 Correct 34 ms 288 KB Output is correct
22 Correct 4 ms 288 KB Output is correct
23 Correct 5 ms 208 KB Output is correct
24 Correct 4 ms 292 KB Output is correct
25 Partially correct 18 ms 292 KB Partially correct - number of queries: 5372
26 Partially correct 18 ms 292 KB Partially correct - number of queries: 5290
27 Correct 5 ms 208 KB Output is correct
28 Partially correct 28 ms 288 KB Partially correct - number of queries: 8667
29 Partially correct 44 ms 292 KB Partially correct - number of queries: 6707
30 Partially correct 75 ms 208 KB Partially correct - number of queries: 9052
31 Correct 2 ms 292 KB Output is correct
32 Correct 7 ms 300 KB Output is correct
33 Correct 4 ms 208 KB Output is correct
34 Correct 28 ms 312 KB Output is correct
35 Correct 7 ms 208 KB Output is correct
36 Correct 13 ms 268 KB Output is correct
37 Correct 4 ms 288 KB Output is correct
38 Correct 5 ms 292 KB Output is correct
39 Correct 15 ms 284 KB Output is correct
40 Partially correct 25 ms 292 KB Partially correct - number of queries: 7806
41 Partially correct 25 ms 288 KB Partially correct - number of queries: 5649
42 Partially correct 38 ms 292 KB Partially correct - number of queries: 5649
43 Partially correct 42 ms 288 KB Partially correct - number of queries: 5148
44 Correct 14 ms 292 KB Output is correct
45 Correct 24 ms 208 KB Output is correct
46 Correct 2 ms 292 KB Output is correct
47 Correct 37 ms 208 KB Output is correct
48 Partially correct 52 ms 288 KB Partially correct - number of queries: 6865
49 Correct 9 ms 208 KB Output is correct
50 Partially correct 29 ms 296 KB Partially correct - number of queries: 9106
51 Correct 25 ms 208 KB Output is correct
52 Correct 3 ms 292 KB Output is correct
53 Correct 5 ms 208 KB Output is correct
54 Correct 14 ms 292 KB Output is correct
55 Correct 2 ms 292 KB Output is correct
56 Partially correct 68 ms 292 KB Partially correct - number of queries: 9108
57 Partially correct 22 ms 296 KB Partially correct - number of queries: 6788
58 Partially correct 58 ms 208 KB Partially correct - number of queries: 6895
59 Partially correct 40 ms 208 KB Partially correct - number of queries: 5649
60 Partially correct 46 ms 288 KB Partially correct - number of queries: 5280
61 Correct 3 ms 336 KB Output is correct
62 Correct 2 ms 292 KB Output is correct
63 Correct 5 ms 208 KB Output is correct
64 Correct 2 ms 280 KB Output is correct
65 Correct 5 ms 284 KB Output is correct
66 Correct 9 ms 292 KB Output is correct
67 Correct 5 ms 288 KB Output is correct
68 Correct 6 ms 296 KB Output is correct
69 Correct 5 ms 292 KB Output is correct
70 Correct 2 ms 292 KB Output is correct
71 Partially correct 45 ms 208 KB Partially correct - number of queries: 9324
72 Correct 10 ms 208 KB Output is correct
73 Partially correct 81 ms 208 KB Partially correct - number of queries: 9196
74 Partially correct 71 ms 208 KB Partially correct - number of queries: 9245
75 Correct 4 ms 208 KB Output is correct
76 Partially correct 52 ms 208 KB Partially correct - number of queries: 7983
77 Partially correct 58 ms 208 KB Partially correct - number of queries: 9179
78 Correct 5 ms 336 KB Output is correct
79 Correct 29 ms 208 KB Output is correct
80 Partially correct 80 ms 208 KB Partially correct - number of queries: 9186
81 Partially correct 54 ms 208 KB Partially correct - number of queries: 9190
82 Partially correct 60 ms 208 KB Partially correct - number of queries: 8989
83 Correct 7 ms 208 KB Output is correct
84 Partially correct 65 ms 208 KB Partially correct - number of queries: 7568
85 Partially correct 67 ms 208 KB Partially correct - number of queries: 9195
86 Partially correct 56 ms 208 KB Partially correct - number of queries: 8040
87 Correct 9 ms 208 KB Output is correct
88 Partially correct 63 ms 208 KB Partially correct - number of queries: 7606
89 Correct 32 ms 208 KB Output is correct
90 Correct 6 ms 292 KB Output is correct
91 Partially correct 42 ms 208 KB Partially correct - number of queries: 5349
92 Correct 34 ms 208 KB Output is correct
93 Partially correct 30 ms 208 KB Partially correct - number of queries: 8662
94 Partially correct 75 ms 208 KB Partially correct - number of queries: 9029
95 Partially correct 59 ms 208 KB Partially correct - number of queries: 9033
96 Partially correct 70 ms 208 KB Partially correct - number of queries: 8939
97 Partially correct 63 ms 208 KB Partially correct - number of queries: 8120