Submission #590248

#TimeUsernameProblemLanguageResultExecution timeMemory
590248AlesL0The Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector <bool> is_small; int sum; vector <int> val; int sol = -1; void binary_search(int m, int s, int e, int left, int right){ if (sol != -1)return; vector <int> a = ask(m); if (a[0]+a[1] == 0)sol = m; //if (a[0]+a[1] < sum){is_small[m] = 1; return;} if (e-s <= 1)return; if (a[0]-left > 0)binary_search((s+m)/2, s, m, left, a[1]); if (a[1]-right > 0)binary_search((m+1+e)/2, m+1, e, a[0], right); } int find_best(int n){ if (n == 1)return 0; is_small.resize(n, 0); val.resize(n); sum = 0; for (int i = 0; i <= min(600, n-1); i++){ vector <int> a = ask(i); val[i] = a[0]+a[1]; sum = max(sum, val[i]); } int start = -1; for (int i = 0; i < min(601, n); i++){ //if (val[i] < sum)is_small[i] = 1; if (val[i] >= sum)start = i; if (val[i] == 0)return i; } binary_search(start, 0, n, 0, 0); return sol; }

Compilation message (stderr)

prize.cpp: In function 'void binary_search(int, int, int, int, int)':
prize.cpp:12:22: error: 'ask' was not declared in this scope
   12 |     vector <int> a = ask(m);
      |                      ^~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:26:26: error: 'ask' was not declared in this scope
   26 |         vector <int> a = ask(i);
      |                          ^~~