Submission #942868

#TimeUsernameProblemLanguageResultExecution timeMemory
942868beepbeepsheepA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; // // --- Sample implementation for the task books --- // // To compile this program with the sample grader, place: // books.h books_sample.cpp sample_grader.cpp // in a single folder and run: // g++ books_sample.cpp sample_grader.cpp // in this folder. // #define ll long long void solve(int N, int K, long long A, int S) { // TODO implement this function ll s=1,e=N; for (int i=s;i<=e;i++){ arr[i]=skim(i); } if (e-s+1<K){ impossible(); return; } vector<int> v; for (int i=s;i<=e-K+1;i++){ ll tot=0; for (int j=i;j<=i+K-1;j++){ v.emplace_back(j); tot+=arr[j]; } //cerr<<endl<<i<<' '<<i+K-1<<' '<<tot<<endl; if (tot>=A && tot<=2*A){ answer(v); return; } v.clear(); } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:20:9: error: 'arr' was not declared in this scope
   20 |         arr[i]=skim(i);
      |         ^~~
books.cpp:31:18: error: 'arr' was not declared in this scope
   31 |             tot+=arr[j];
      |                  ^~~