Submission #1053330

# Submission time Handle Problem Language Result Execution time Memory
1053330 2024-08-11T10:33:40 Z Unforgettablepl The Big Prize (IOI17_prize) C++17
20 / 100
40 ms 428 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

const int THRESHOLD_JUMP = 480;
const int BIGGER_JUMP = 256;

int find_best(int n){
    int worst_case = 0;
    for(int i=0;i<480;i++) {
        auto curr = ask(i);
        int c = curr[0]+curr[1];
        if(c==0)return i;
        worst_case = max(worst_case,c);
    }
    for(int i=480;i<n;i++) {
        auto base = ask(i);
        int curr = base[0]+base[1];
        if(curr==0)return i;
        if(curr==worst_case) {
            for(int jump=BIGGER_JUMP;jump;jump/=2) {
                if(i+jump>=n)continue;
                auto temp = ask(i+jump);
                if(temp==base)i+=jump;
            }
        } else {
            int curradded = 0;
            for(int jump=256;jump;jump/=2) {
                if(i+jump>=n)continue;
                if(curradded+jump>THRESHOLD_JUMP)continue;
                auto temp = ask(i+jump);
                if(temp==base){
                    i+=jump;
                    curradded+=jump;
                }
            }
        }
    }
}

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 4 ms 344 KB Output is correct
2 Correct 14 ms 344 KB Output is correct
3 Correct 13 ms 344 KB Output is correct
4 Correct 17 ms 344 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 9 ms 428 KB Output is correct
8 Correct 13 ms 344 KB Output is correct
9 Correct 7 ms 344 KB Output is correct
10 Correct 22 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 11 ms 344 KB Output is correct
3 Correct 13 ms 344 KB Output is correct
4 Correct 18 ms 344 KB Output is correct
5 Correct 10 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 11 ms 344 KB Output is correct
8 Correct 10 ms 344 KB Output is correct
9 Correct 10 ms 344 KB Output is correct
10 Correct 13 ms 344 KB Output is correct
11 Correct 9 ms 344 KB Output is correct
12 Correct 3 ms 344 KB Output is correct
13 Correct 16 ms 344 KB Output is correct
14 Correct 4 ms 344 KB Output is correct
15 Correct 8 ms 344 KB Output is correct
16 Partially correct 36 ms 344 KB Partially correct - number of queries: 8271
17 Correct 2 ms 344 KB Output is correct
18 Partially correct 40 ms 344 KB Partially correct - number of queries: 9891
19 Correct 3 ms 344 KB Output is correct
20 Correct 11 ms 344 KB Output is correct
21 Correct 9 ms 344 KB Output is correct
22 Correct 6 ms 344 KB Output is correct
23 Correct 4 ms 344 KB Output is correct
24 Correct 3 ms 428 KB Output is correct
25 Partially correct 31 ms 344 KB Partially correct - number of queries: 6541
26 Partially correct 23 ms 344 KB Partially correct - number of queries: 6391
27 Correct 4 ms 340 KB Output is correct
28 Incorrect 33 ms 344 KB Incorrect
29 Halted 0 ms 0 KB -