제출 #529626

#제출 시각아이디문제언어결과실행 시간메모리
529626mjhmjh1104A Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include <map> #include "books.h" using namespace std; map<int, long long> m; int s; long long ask(int x) { return skim(x); if (s) { s--; return skim(x); } else return (long long)4e18; } long long get(int x, int K) { long long ret = 0; for (int i = 0; i < K; i++) { if (m.find(x + i + 1) == m.end()) m[x + i + 1] = ask(x + i + 1); ret += m[x + i + 1]; if (ret > (long long)4e18) ret = (long long)4e18; } return ret; } void solve(int N, int K, long long A, int S) { s = S; int l = 0, r = N - K; while (l < r) { int m = (l + r) / 2; long long t = get(m, 1); if (t < A / K) l = m + 1; else r = m; } for (int e = l; e > l - K && e >= 0; e--) { long long t = get(e, K); if (t >= A && t <= 2 * A) { vector<int> v; for (int i = 0; i < K; i++) v.push_back(e + i + 1); answer(v); return; } else if (t < A) { l = e + K; goto next:; } } impossible(); next:; r = 0; while (r + K - 1 <= l) { if (get(r, K - 1) + get(l, 1) > 2 * A) break; if (get(r, K - 1) + get(l, 1) >= A) { vector<int> v; for (int i = 0; i < K - 1; i++) v.push_back(r + i + 1); v.push_back(l + 1); answer(v); return; } r++; } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:44:22: error: expected ';' before ':' token
   44 |             goto next:;
      |                      ^
      |                      ;
books.cpp:44:22: error: expected primary-expression before ':' token