Submission #852904

#TimeUsernameProblemLanguageResultExecution timeMemory
852904Trisanu_DasA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; long long a[100005]; void solve(int n, int k, long long A, int s) { for(int i = 1; i <= k; i++) a[i] = skim(i); long long sm = 0; for(int i = 1; i <= K; i++){ sm += a[i]; if(sm > 2 * A){ impossible(); return; } } int l = k, h = n, m, ans; while(l <= h){ m = (l + h)/2; if(skim(m) + sm - a[K] <= 2 * A){ ans = m; low = m + 1; } else h = mid - 1; } int cur = k; for(int i = ans; i > ans-k; i --){ sm -= a[cur]; sm += skim(i); cur--; if(sm >= A){ vector<int> anss; for(int j = i; j <= ans; j++) anss.push_back(j); for(int j = 1; j <= cur; j++) anss.push_back(j); answer(anss); return; } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:10:22: error: 'K' was not declared in this scope
   10 |  for(int i = 1; i <= K; i++){
      |                      ^
books.cpp:20:23: error: 'K' was not declared in this scope
   20 |   if(skim(m) + sm - a[K] <= 2 * A){
      |                       ^
books.cpp:22:4: error: 'low' was not declared in this scope; did you mean 'pow'?
   22 |    low = m + 1;
      |    ^~~
      |    pow
books.cpp:24:12: error: 'mid' was not declared in this scope
   24 |   else h = mid - 1;
      |            ^~~