Submission #1365895

#TimeUsernameProblemLanguageResultExecution timeMemory
1365895lucasdmyA Difficult(y) Choice (BOI21_books)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
void solve(int n, int books, long long int a, int s){
    vector<long long int>v(n+10);
    long long int sum=0;
    vector<int>resp;
    for(int k=1;k<books;k++){
        v[k]=skim(k);
        sum+=v[k];
        res.push_back(k);
    }
    int p1=books, p2=n;
    while(p1<p2){
        int m=(p1+p2+1)/2;
        v[m]=skim(m);
        if(a<=v[m]+sum and v[m]+sum<=2*a){
            resp.push_back(m);
            answer(resp);
        }
        if(v[m]+sum<a){
            p1=m;
        }else{
            p2=m-1;
        }
    }
    resp.push_back(p1);
    sum+=v[p1];
    for(int k=p1-1;k>=p1-books+1;k--){
        int aux=skim(k);
        int idx=books-(p1-k)-1;
        resp[idx]=k;
        sum+=aux-v[idx];
        if(sum>=a){
            answer(resp);
        }
    }
    impossible();
}

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:8:14: error: 'skim' was not declared in this scope
    8 |         v[k]=skim(k);
      |              ^~~~
books.cpp:10:9: error: 'res' was not declared in this scope; did you mean 'resp'?
   10 |         res.push_back(k);
      |         ^~~
      |         resp
books.cpp:15:14: error: 'skim' was not declared in this scope
   15 |         v[m]=skim(m);
      |              ^~~~
books.cpp:18:13: error: 'answer' was not declared in this scope
   18 |             answer(resp);
      |             ^~~~~~
books.cpp:29:17: error: 'skim' was not declared in this scope
   29 |         int aux=skim(k);
      |                 ^~~~
books.cpp:34:13: error: 'answer' was not declared in this scope
   34 |             answer(resp);
      |             ^~~~~~
books.cpp:37:5: error: 'impossible' was not declared in this scope
   37 |     impossible();
      |     ^~~~~~~~~~