Submission #799757

#TimeUsernameProblemLanguageResultExecution timeMemory
799757LiudasThe Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
int find_best(int N){
    int step = sqrt(N);
    auto t = ask(0);
    int s = t[0] + t[1];
    int ans = 0;
    while(s){
        for(int i = (N - 1) % step; i < N; i += step){
            int l = max(0, i - step);
            auto k = ask(i);
            if(k[0]){
                for(int j = l; j <= i; j ++){
                    k = ask(j);
                    if(k[0] + k[1] < s){
                        s = k[0] + k[1];
                        ans = j;
                        i = 1e9;
                        break;
                    }
                }
            }
        }
    }
    return ans;
}

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:5:14: error: 'ask' was not declared in this scope
    5 |     auto t = ask(0);
      |              ^~~