제출 #597860

#제출 시각아이디문제언어결과실행 시간메모리
597860yanndevThe Big Prize (IOI17_prize)C++17
컴파일 에러
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; vector<int> ans[200042]; vector<int> query(int i) { if (ans[i].empty()) return ans[i] = ask(i); return ans[i]; } int find_best(int n) { int mxVal = 0; for (int i = 0; i < min(n, 480); i++) { auto x = query(i); mxVal = max(mxVal, x[0] + x[1]); } for (int i = 0; i < n; i++) { vector<int> a = query(i); if (a[0] == 0 && a[1] == 0) return i; if (a[0] + b[1] < mxVal) continue; int l = i; int r = n - 1; while (l < r) { int m = (l + r + 1) / 2; vector<int> b = query(m); if (b[0] + b[1] == mxVal) l = m; else r = m - 1; } //cout << "poor range " << i << ' ' << l << '\n'; i = r; } }

컴파일 시 표준 에러 (stderr) 메시지

prize.cpp: In function 'int find_best(int)':
prize.cpp:24:20: error: 'b' was not declared in this scope
   24 |         if (a[0] + b[1] < mxVal)
      |                    ^
prize.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^