Submission #1214566

#TimeUsernameProblemLanguageResultExecution timeMemory
1214566exoworldgdThe Big Prize (IOI17_prize)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; map<int,vector<int>> mp; vector<int> q(int idx) { if (mp.find(idx) != mp.end()) return mp[pos]; vector<int> res = ask(pos); mp[pos] = res; return res; } int find_best(int n) { mp.clear(); int l = 0, r = n-1; while (l <= r) { int m = l+(r-l)/2; vector<int> res = q(m); int ll = res[0], rr = res[1]; if (ll+rr == n-1) return m; if (ll>rr) r = m-1; else l = m+1; } for (int i = 0; i < n; i++) { vector<int> res = query(i); if (res[0]+res[1] == n-1) return i; } return 0; }

Compilation message (stderr)

prize.cpp: In function 'std::vector<int> q(int)':
prize.cpp:5:45: error: 'pos' was not declared in this scope; did you mean 'pow'?
    5 |     if (mp.find(idx) != mp.end()) return mp[pos];
      |                                             ^~~
      |                                             pow
prize.cpp:6:27: error: 'pos' was not declared in this scope; did you mean 'pow'?
    6 |     vector<int> res = ask(pos);
      |                           ^~~
      |                           pow
prize.cpp:6:23: error: 'ask' was not declared in this scope
    6 |     vector<int> res = ask(pos);
      |                       ^~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:22:27: error: 'query' was not declared in this scope
   22 |         vector<int> res = query(i);
      |                           ^~~~~