제출 #772950

#제출 시각아이디문제언어결과실행 시간메모리
772950ImeonA 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) { // cin >> N >> K >> S >> A; long long x[N + 1]; long long sm = 0; int f = 0; for (int i = 1; i <= S + 1;i++){ // cin >> x[i]; x[i] = skim(i); sm += x[i]; f++; if (f > K){sm -= x[i - K - 1];} if (f > K and sm >= A and sm <= 2LL * A){ vector<int>v; for (int j = i - K; j <= i; j++){ // cout << j << " "; v.push_back(j); } // cout << '\n'; answer(v); ok = 1; } } K--; f = 0; sm = 0; for (int i = 1; i <= S + 1;i++){ // cin >> x[i]; //x[i] = skim(i); sm += x[i]; f++; if (f > K){sm -= x[i - K - 1];} if (f >= K){ int l = 0,r = N + 1; while (l + 1 < r){ int md = (l + r) / 2; // if ((x[md] + sm) < A)l = md; if ((x[md] + sm) > 2ll * A)r = md; else l = md; } } if (f == k) if (f > K and sm >= A and sm <= 2LL * A){ vector<int>v; for (int j = i - K; j <= i; j++){ // cout << j << " "; v.push_back(j); } // cout << '\n'; answer(v); } } // cout << -1; impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:24:13: error: 'ok' was not declared in this scope
   24 |             ok = 1;
      |             ^~
books.cpp:45:18: error: 'k' was not declared in this scope
   45 |         if (f == k)
      |                  ^