Submission #865424

#TimeUsernameProblemLanguageResultExecution timeMemory
865424AlebnA Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include "books.h"
 
#define ll unsigned long long
 
using namespace std;
 
void solve(int n, int k, ll A, int S) {
    vector<ll> a(n);
    bool ok = false;
    ll sum = 0;
    int mid = -1;
    for(int i = 0; i < n; i++) {
        a[i] = skim(i+1);
        if(a[i] >= A && mid == -1) mid = i; 
    }
    for(int i = 0; i < k-1; i++) sum+=a[i];
    mid = max(mid, k-1);
    for(int i = mid; i > k-2; i--) {
        if(sum+a[i] >= A && sum+a[i] <= 2*A) {
            vector<int> b(k);
            for(int j = 0; j < k-1; j++) b[j] = j+1;
            b[k-1] = i+1;
            answer(b);
            return;
            ok = true;
        }
    }
    if(!ok) impossible();
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cclnbJc1.o: in function `main':
grader.cpp:(.text.startup+0x83): undefined reference to `solve(int, int, long long, int)'
collect2: error: ld returned 1 exit status