Submission #1002527

#TimeUsernameProblemLanguageResultExecution timeMemory
1002527ocasuDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define origInt int

std::vector<origInt> find_subset(origInt l, origInt u, std::vector<origInt> z) {
    vector<int> w=z;
    sort(w.begin(),w.end());

    int n=(int)(w.size());
    int pre=0, x=0;
    for (auto i: w){
        if (pre+i<l) pre+=i, x++;
    }
    if (x==0){
        return {0};
    }
    int sum=pre, nxt=x, prev=0;
    while (sum<l and nxt<n){
        sum-=w[prev]; sum+=w[nxt];
        nxt++;
        prev++;
    }
    if (sum<l){
        return {};
    }
    vector<int> ans;
    for (int i=prev; i<nxt; i++){
        ans.push_back(i);
    }
    return ans;
    
    
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccjEQ7oP.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status