제출 #550361

#제출 시각아이디문제언어결과실행 시간메모리
550361Zhora_004A Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; void solve(int n, int k, long long a, int s) { vector<long long> x(n); vector<int> vec; ll sum = 0; for (int i = 0; i < k - 1; i++) { x[i] = skim(i + 1); sum += x[i]; vec.push_back(i + 1); } int l = k - 1, r = n; while (l != r) { int m = (l + r) >> 1; if (x[m] == 0) x[m] = skim(m + 1); if (x[m] <= a) l = m + 1; else r = m; } if (r < n) { sum += x[r]; vec.push_back(r + 1); if (a <= sum && sum <= a * 2) answer(vec); } vector<long long> nums; for (int i = 0; i < k; i++) { if (x[i] == 0) x[i] = skim(i + 1); nums.push_back(i + 1); } for (int i = r - k; i < r; i++) { if (x[i] == 0) x[i] = skim(i + 1); nums.push_back(i + 1); } for (int i = 0; i + k - 1 < (int)(nums.size()); i++) { sum = 0; vec.clear(); for (int j = i; j <= i + k - 1; j++) { sum += x[nums[j]]; vec.push_back(nums[j] + 1); } if (a <= sum && sum <= a * 2) answer(vec); } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:10:5: error: 'll' was not declared in this scope
   10 |     ll sum = 0;
      |     ^~
books.cpp:14:9: error: 'sum' was not declared in this scope
   14 |         sum += x[i];
      |         ^~~
books.cpp:27:9: error: 'sum' was not declared in this scope
   27 |         sum += x[r];
      |         ^~~
books.cpp:44:9: error: 'sum' was not declared in this scope
   44 |         sum = 0;
      |         ^~~