제출 #789098

#제출 시각아이디문제언어결과실행 시간메모리
789098t6twotwo커다란 상품 (IOI17_prize)C++17
컴파일 에러
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> memo; vector<int> K(int i) { if(memo[i][0] != -1) return memo[i]; return ans(i); } int find_best(int N) { memo.resize(N, {-1, -1}); int lol = -1, ted = -1, cnt = 0; vector<vector<int>> a(473); for (int i = 0; i < 473; i++) { a[i] = K(i); int s = a[i][0] + a[i][1]; if (s == 0) { return i; } lol = max(lol, s); } for (int i = 0; i < 473; i++) { int s = a[i][0] + a[i][1]; if (s < lol) { cnt++; ted = max(ted, s); } } int x = 473; while (cnt < 26) { vector<int> t = K(x); int s = t[0] + t[1]; if (s == 0) { return x; } if (s == lol) { int lo = x, hi = N - 1; while (lo < hi) { int mi = (lo + hi + 1) / 2; vector<int> v = K(mi); if (v == t) { lo = mi; } else { hi = mi - 1; } } x = lo; } else { cnt++; ted = max(ted, s); } x++; } while (1) { vector<int> t = K(x); int s = t[0] + t[1]; if (s == 0) { return x; } if (s < ted) { x++; continue; } if (s == lol) {//sus int lo = x, hi = N - 1; while (lo < hi) { int mi = (lo + hi + 1) / 2; vector<int> v = K(mi); if (v == t) { lo = mi; } else { hi = mi - 1; } } x = lo + 1; } else { int lo = x, hi = N - 1; while (lo < hi) { int mi = (lo + hi + 1) / 2; vector<int> v = K(mi); if (v == t) { lo = mi; } else if (v[0] + v[1] == lol) { int l = lo + 1, r = mi; while (l < r) { int m = (l + r) / 2; vector<int> u = K(m); if (u == v) { r = m; } else { l = m + 1; } } if (K(l - 1) == t) { lo = mi; } else { hi = mi - 1; } } else { hi = mi - 1; } } x = lo + 1; } } }

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

prize.cpp: In function 'std::vector<int> K(int)':
prize.cpp:7:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |  return ans(i);
      |         ^~~
      |         abs