제출 #575518

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

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:18:9: error: 'vs' was not declared in this scope; did you mean 's'?
   18 |         vs[i] = 0;
      |         ^~
      |         s