Submission #470643

# Submission time Handle Problem Language Result Execution time Memory
470643 2021-09-04T16:37:03 Z Carmel_Ab1 The Big Prize (IOI17_prize) C++17
20 / 100
145 ms 328 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int>vi;

//#include "grader.cpp"

int find_best(int n) {

    int sz=450;
    vi prv={-1,-1};
    for(int i=0; i<n; i+=sz){
        vi s=(prv[0]==-1?ask(i):prv),e=ask(min(n-1,i+sz));
        if(s[0]==0 && s[1]==0)
            return i;
        if(e[0]==0 && e[1]==0)
            return min(i+sz,n-1);
        if(e[0]==s[0])
            continue;
        for(int j=i; j<=min(n-1,i+sz); j++) {
            vi v=ask(j);
            if(v[0]==0 && v[1]==0)
                return j;
        }
        prv=e;
    }
    assert(0);
    return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 200 KB Output is correct
2 Correct 3 ms 280 KB Output is correct
3 Correct 3 ms 288 KB Output is correct
4 Correct 9 ms 200 KB Output is correct
5 Correct 5 ms 200 KB Output is correct
6 Correct 0 ms 284 KB Output is correct
7 Correct 7 ms 200 KB Output is correct
8 Correct 5 ms 280 KB Output is correct
9 Correct 7 ms 200 KB Output is correct
10 Correct 18 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 200 KB Output is correct
2 Correct 3 ms 284 KB Output is correct
3 Correct 7 ms 200 KB Output is correct
4 Correct 12 ms 284 KB Output is correct
5 Correct 5 ms 284 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 3 ms 328 KB Output is correct
8 Correct 5 ms 200 KB Output is correct
9 Correct 7 ms 200 KB Output is correct
10 Correct 13 ms 200 KB Output is correct
11 Partially correct 57 ms 200 KB Partially correct - number of queries: 6728
12 Correct 6 ms 200 KB Output is correct
13 Incorrect 145 ms 200 KB Incorrect
14 Halted 0 ms 0 KB -