Submission #960658

# Submission time Handle Problem Language Result Execution time Memory
960658 2024-04-10T20:07:29 Z MarwenElarbi The Big Prize (IOI17_prize) C++17
90 / 100
57 ms 608 KB
#include <bits/stdc++.h>
#include "prize.h"

using namespace std;
std::vector<int> ask(int i);

int find_best(int n){
    int bg=0;
    int cnt=0;
    for (int i = 0; i < min(480,n); ++i)
    {
        vector<int> cur=ask(i);
        if(cur[0]==0&&cur[1]==0) return i;
        if(cnt<=cur[0]+cur[1]){
            cnt=max(cnt,cur[0]+cur[1]);
            bg=i;
        }
    }
    bool vis[n];
    memset(vis,0,sizeof vis);
    while(true){
        //return 0;
        int l=bg;
        int r=n;
        //cout <<l<<endl;
        vector<int> fir=ask(l);
        while(r-l>1){
            int mid=(r+l)/2;
            vector<int> cur=ask(mid);
            vis[mid]=true;
            if(cur[0]==0&&cur[1]==0) return mid;
            if(cur[0]+cur[1]!=cnt){
                r=mid;
                continue;
            }
            if(cur[1]+fir[0]!=cnt) r=mid;
            else {
                l=mid;
            }
        }
        bg=l+1;
        while(vis[bg]) bg++;
        fir=ask(bg);
        if(fir[0]==0&&fir[1]==0) return bg;
        while(fir[0]+fir[1]!=cnt){
            bg++;
            if(vis[bg]) continue;
            fir=ask(bg);
            if(fir[0]==0&&fir[1]==0) return bg;
        }
    }
    return n-1;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 436 KB Output is correct
2 Correct 2 ms 440 KB Output is correct
3 Correct 3 ms 432 KB Output is correct
4 Correct 3 ms 436 KB Output is correct
5 Correct 2 ms 444 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 3 ms 440 KB Output is correct
8 Correct 3 ms 608 KB Output is correct
9 Correct 3 ms 436 KB Output is correct
10 Correct 4 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 432 KB Output is correct
2 Correct 2 ms 440 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 4 ms 600 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 3 ms 440 KB Output is correct
8 Correct 2 ms 436 KB Output is correct
9 Correct 2 ms 436 KB Output is correct
10 Correct 2 ms 436 KB Output is correct
11 Correct 3 ms 436 KB Output is correct
12 Correct 2 ms 432 KB Output is correct
13 Correct 6 ms 608 KB Output is correct
14 Correct 3 ms 432 KB Output is correct
15 Correct 9 ms 436 KB Output is correct
16 Partially correct 35 ms 436 KB Partially correct - number of queries: 7794
17 Correct 2 ms 344 KB Output is correct
18 Partially correct 46 ms 440 KB Partially correct - number of queries: 9083
19 Correct 2 ms 600 KB Output is correct
20 Correct 11 ms 436 KB Output is correct
21 Correct 18 ms 432 KB Output is correct
22 Correct 7 ms 608 KB Output is correct
23 Correct 2 ms 440 KB Output is correct
24 Correct 3 ms 432 KB Output is correct
25 Partially correct 30 ms 432 KB Partially correct - number of queries: 5312
26 Partially correct 26 ms 444 KB Partially correct - number of queries: 5222
27 Correct 2 ms 436 KB Output is correct
28 Partially correct 54 ms 428 KB Partially correct - number of queries: 8631
29 Partially correct 42 ms 436 KB Partially correct - number of queries: 6653
30 Partially correct 51 ms 432 KB Partially correct - number of queries: 9031
31 Correct 2 ms 344 KB Output is correct
32 Correct 3 ms 436 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 14 ms 608 KB Output is correct
35 Correct 3 ms 432 KB Output is correct
36 Correct 12 ms 436 KB Output is correct
37 Correct 3 ms 436 KB Output is correct
38 Correct 2 ms 608 KB Output is correct
39 Correct 20 ms 436 KB Output is correct
40 Partially correct 45 ms 608 KB Partially correct - number of queries: 7793
41 Partially correct 24 ms 436 KB Partially correct - number of queries: 5612
42 Partially correct 26 ms 436 KB Partially correct - number of queries: 5612
43 Partially correct 23 ms 436 KB Partially correct - number of queries: 5120
44 Correct 20 ms 432 KB Output is correct
45 Correct 17 ms 432 KB Output is correct
46 Correct 2 ms 344 KB Output is correct
47 Correct 23 ms 436 KB Output is correct
48 Partially correct 44 ms 436 KB Partially correct - number of queries: 6839
49 Correct 5 ms 436 KB Output is correct
50 Partially correct 46 ms 432 KB Partially correct - number of queries: 9074
51 Correct 19 ms 436 KB Output is correct
52 Correct 2 ms 608 KB Output is correct
53 Correct 3 ms 436 KB Output is correct
54 Correct 25 ms 436 KB Output is correct
55 Correct 2 ms 340 KB Output is correct
56 Partially correct 49 ms 436 KB Partially correct - number of queries: 9096
57 Partially correct 36 ms 428 KB Partially correct - number of queries: 6751
58 Partially correct 45 ms 436 KB Partially correct - number of queries: 6846
59 Partially correct 24 ms 440 KB Partially correct - number of queries: 5610
60 Partially correct 24 ms 440 KB Partially correct - number of queries: 5250
61 Correct 2 ms 432 KB Output is correct
62 Correct 2 ms 432 KB Output is correct
63 Correct 3 ms 432 KB Output is correct
64 Correct 2 ms 436 KB Output is correct
65 Correct 3 ms 432 KB Output is correct
66 Correct 5 ms 436 KB Output is correct
67 Correct 2 ms 424 KB Output is correct
68 Correct 2 ms 344 KB Output is correct
69 Correct 5 ms 432 KB Output is correct
70 Correct 2 ms 440 KB Output is correct
71 Partially correct 51 ms 436 KB Partially correct - number of queries: 9249
72 Correct 6 ms 428 KB Output is correct
73 Partially correct 57 ms 436 KB Partially correct - number of queries: 9123
74 Partially correct 52 ms 432 KB Partially correct - number of queries: 9191
75 Correct 3 ms 440 KB Output is correct
76 Partially correct 41 ms 432 KB Partially correct - number of queries: 7918
77 Partially correct 45 ms 436 KB Partially correct - number of queries: 9122
78 Correct 4 ms 436 KB Output is correct
79 Correct 17 ms 440 KB Output is correct
80 Partially correct 51 ms 432 KB Partially correct - number of queries: 9107
81 Partially correct 51 ms 432 KB Partially correct - number of queries: 9108
82 Partially correct 44 ms 436 KB Partially correct - number of queries: 9006
83 Correct 4 ms 436 KB Output is correct
84 Partially correct 36 ms 432 KB Partially correct - number of queries: 7479
85 Partially correct 42 ms 432 KB Partially correct - number of queries: 9048
86 Correct 3 ms 436 KB Output is correct
87 Correct 2 ms 432 KB Output is correct
88 Correct 3 ms 440 KB Output is correct
89 Correct 2 ms 432 KB Output is correct
90 Correct 2 ms 432 KB Output is correct
91 Correct 4 ms 440 KB Output is correct
92 Correct 2 ms 432 KB Output is correct
93 Correct 6 ms 436 KB Output is correct
94 Correct 4 ms 436 KB Output is correct
95 Correct 4 ms 436 KB Output is correct
96 Correct 3 ms 588 KB Output is correct
97 Correct 2 ms 432 KB Output is correct