Submission #102063

# Submission time Handle Problem Language Result Execution time Memory
102063 2019-03-22T01:37:16 Z tim25871014 The Big Prize (IOI17_prize) C++17
90 / 100
75 ms 512 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int find_best(int n){

    int loli=0;
    for(int i=0;i<(int)min(500,n);i++){
        vector<int> val=ask(i);
        loli=max(loli,val[0]+val[1]);
    }

    for(int i=0;i<n;i++){
        vector<int> val=ask(i);
        if(val[0]+val[1]==0) return i;
        if(val[0]+val[1]==loli){

            int lb=i,ub=n;
            while(ub-lb>1){
                int mid=ub+lb>>1;
                vector<int> ser=ask(mid);
                if(val[0]==ser[0] && ser[0]+ser[1]==loli)
                    lb=mid;
                else ub=mid;
            }
            i=lb;
        }
    }
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:20:27: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
                 int mid=ub+lb>>1;
                         ~~^~~
prize.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 304 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 512 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 4 ms 512 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 8 ms 256 KB Output is correct
7 Correct 4 ms 308 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 6 ms 256 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 4 ms 512 KB Output is correct
13 Correct 9 ms 304 KB Output is correct
14 Correct 9 ms 256 KB Output is correct
15 Correct 8 ms 384 KB Output is correct
16 Partially correct 44 ms 308 KB Partially correct - number of queries: 7833
17 Correct 3 ms 388 KB Output is correct
18 Partially correct 39 ms 384 KB Partially correct - number of queries: 9109
19 Correct 5 ms 256 KB Output is correct
20 Correct 26 ms 256 KB Output is correct
21 Correct 28 ms 256 KB Output is correct
22 Correct 6 ms 376 KB Output is correct
23 Correct 5 ms 256 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Partially correct 42 ms 384 KB Partially correct - number of queries: 5372
26 Partially correct 40 ms 304 KB Partially correct - number of queries: 5290
27 Correct 5 ms 256 KB Output is correct
28 Partially correct 63 ms 256 KB Partially correct - number of queries: 8667
29 Partially correct 54 ms 256 KB Partially correct - number of queries: 6707
30 Partially correct 69 ms 284 KB Partially correct - number of queries: 9052
31 Correct 7 ms 256 KB Output is correct
32 Correct 5 ms 312 KB Output is correct
33 Correct 3 ms 256 KB Output is correct
34 Correct 12 ms 376 KB Output is correct
35 Correct 7 ms 304 KB Output is correct
36 Correct 22 ms 256 KB Output is correct
37 Correct 7 ms 256 KB Output is correct
38 Correct 8 ms 256 KB Output is correct
39 Correct 17 ms 376 KB Output is correct
40 Partially correct 37 ms 256 KB Partially correct - number of queries: 7806
41 Partially correct 46 ms 316 KB Partially correct - number of queries: 5649
42 Partially correct 46 ms 256 KB Partially correct - number of queries: 5649
43 Partially correct 20 ms 312 KB Partially correct - number of queries: 5148
44 Correct 32 ms 256 KB Output is correct
45 Correct 26 ms 256 KB Output is correct
46 Correct 7 ms 304 KB Output is correct
47 Correct 34 ms 384 KB Output is correct
48 Partially correct 29 ms 384 KB Partially correct - number of queries: 6865
49 Correct 11 ms 384 KB Output is correct
50 Partially correct 59 ms 392 KB Partially correct - number of queries: 9106
51 Correct 15 ms 384 KB Output is correct
52 Correct 4 ms 312 KB Output is correct
53 Correct 7 ms 256 KB Output is correct
54 Correct 30 ms 432 KB Output is correct
55 Correct 6 ms 256 KB Output is correct
56 Partially correct 31 ms 412 KB Partially correct - number of queries: 9108
57 Partially correct 40 ms 256 KB Partially correct - number of queries: 6788
58 Partially correct 33 ms 256 KB Partially correct - number of queries: 6895
59 Partially correct 41 ms 384 KB Partially correct - number of queries: 5649
60 Partially correct 25 ms 256 KB Partially correct - number of queries: 5280
61 Correct 7 ms 256 KB Output is correct
62 Correct 5 ms 256 KB Output is correct
63 Correct 4 ms 504 KB Output is correct
64 Correct 6 ms 432 KB Output is correct
65 Correct 8 ms 304 KB Output is correct
66 Correct 9 ms 256 KB Output is correct
67 Correct 6 ms 384 KB Output is correct
68 Correct 11 ms 284 KB Output is correct
69 Correct 5 ms 432 KB Output is correct
70 Correct 6 ms 256 KB Output is correct
71 Partially correct 37 ms 512 KB Partially correct - number of queries: 9229
72 Correct 7 ms 256 KB Output is correct
73 Partially correct 59 ms 256 KB Partially correct - number of queries: 9123
74 Partially correct 60 ms 256 KB Partially correct - number of queries: 9165
75 Correct 8 ms 256 KB Output is correct
76 Partially correct 34 ms 256 KB Partially correct - number of queries: 7948
77 Partially correct 44 ms 512 KB Partially correct - number of queries: 9116
78 Correct 6 ms 384 KB Output is correct
79 Correct 30 ms 256 KB Output is correct
80 Partially correct 75 ms 256 KB Partially correct - number of queries: 9111
81 Partially correct 34 ms 512 KB Partially correct - number of queries: 9113
82 Partially correct 64 ms 256 KB Partially correct - number of queries: 9047
83 Correct 7 ms 384 KB Output is correct
84 Partially correct 64 ms 384 KB Partially correct - number of queries: 7559
85 Partially correct 59 ms 512 KB Partially correct - number of queries: 9147
86 Correct 9 ms 256 KB Output is correct
87 Correct 4 ms 396 KB Output is correct
88 Correct 5 ms 384 KB Output is correct
89 Correct 12 ms 256 KB Output is correct
90 Correct 4 ms 384 KB Output is correct
91 Correct 8 ms 384 KB Output is correct
92 Correct 4 ms 256 KB Output is correct
93 Correct 14 ms 256 KB Output is correct
94 Correct 12 ms 256 KB Output is correct
95 Correct 12 ms 256 KB Output is correct
96 Correct 6 ms 400 KB Output is correct
97 Correct 11 ms 256 KB Output is correct