Submission #615635

#TimeUsernameProblemLanguageResultExecution timeMemory
615635IvanJThe Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "prize.h" using namespace std; const int maxn = 2e5 + 5; vector<int> A[maxn]; vector<int> V; void find(int lo, int hi) { int mid = (lo + hi) / 2; if(A[mid].size() == 0) A[mid] = ask(i); if(A[mid][0] + A[mid][1] < A[hi][0] + A[hi][1]) {V.pb(mid);return;} if(A[mid][1] == A[hi][1]) hi = mid; else lo = mid + 1; } void solve(int lo, int hi) { if(lo == 0 && A[hi][0] == 0) return; if(lo == 0 && A[hi][0] == 1) {find(lo, hi);return;} if(A[lo - 1][1] == A[hi][1]) return; if(A[lo - 1][1] == A[hi][1] + 1) {find(lo, hi);return;} int mid = (lo + hi) / 2; int mid1 = mid; while(1) { if(A[mid1].size() == 0) A[mid1] = ask(mid1); if(A[mid1][0] + A[mid1][1] < A[hi][0] + A[hi][1]) V.pb(mid1), mid1--; else break; if(mid1 < lo) break; } if(lo < mid1) solve(lo, mid1); solve(mid + 1, hi); } int find_best(int n) { if(n <= 5000) { for(int i = 0;i < n;i++) { vector<int> v = ask(i); if(v[0] + v[1] == 0) return i; } } int pos = -1; for(int i = n - 1;i >= n - 500;i--) { A[i] = ask(i); if(pos == -1 || A[i][0] + A[i][1] > A[pos][0] + A[pos][1]) pos = i; } for(int i = pos + 1;i < n;i++) V.pb(i); solve(0, pos); for(int i : V) { A[i] = ask(i); if(A[i][0] + A[i][1] == 0) return i; } }

Compilation message (stderr)

prize.cpp: In function 'void find(int, int)':
prize.cpp:13:38: error: 'i' was not declared in this scope; did you mean 'hi'?
   13 |  if(A[mid].size() == 0) A[mid] = ask(i);
      |                                      ^
      |                                      hi
prize.cpp:14:53: error: 'class std::vector<int>' has no member named 'pb'
   14 |  if(A[mid][0] + A[mid][1] < A[hi][0] + A[hi][1]) {V.pb(mid);return;}
      |                                                     ^~
prize.cpp: In function 'void solve(int, int)':
prize.cpp:29:55: error: 'class std::vector<int>' has no member named 'pb'
   29 |   if(A[mid1][0] + A[mid1][1] < A[hi][0] + A[hi][1]) V.pb(mid1), mid1--;
      |                                                       ^~
prize.cpp: In function 'int find_best(int)':
prize.cpp:53:35: error: 'class std::vector<int>' has no member named 'pb'
   53 |  for(int i = pos + 1;i < n;i++) V.pb(i);
      |                                   ^~
prize.cpp:60:1: warning: control reaches end of non-void function [-Wreturn-type]
   60 | }
      | ^