Submission #574819

#TimeUsernameProblemLanguageResultExecution timeMemory
574819MajidA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
#define f first
#define s second
const int MOD = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

ll skim(ll x){
    
    return x+2;
}

void solve(int n, int k, ll a, int s){
    
    vector<ll> vec(n);
    
    for(ll i = 0; i < n; i++){
        
        vec[i] = skim(i+1);
    }
    
    ll sum = 0;
    
    vector<int> temp;
    
    for(ll i = n-1; i >= 0; i--){
        
        if(sum < a){
            
            if(sz(temp)<k){
                
                if(sum + vec[i] <= 2*a){
                    
                    sum+=vec[i];
                    temp.pb(i);
                }
            }
        }
    }
    
    if(sum>=a and sum<=2*a){
            
        answer(temp);
    }
    
    else impossible();
    // answer(temp);
    
    
}
// 
// int main(){
// 
//     solve(5, 3, 10, 0);
// }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, ll, int)':
books.cpp:49:9: error: 'answer' was not declared in this scope
   49 |         answer(temp);
      |         ^~~~~~
books.cpp:52:10: error: 'impossible' was not declared in this scope
   52 |     else impossible();
      |          ^~~~~~~~~~