Submission #1026375

#TimeUsernameProblemLanguageResultExecution timeMemory
1026375ezzzayDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
#define pb push_back
#define ff first
#define ss second
#define int long long
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    int n=w.size();
    vector<pair<int,int>>vc;
    for(int i=0;i<n;i++){
        vc.pb({w[i],i});
    }
    sort(vc.begin(),vc.end());
    int L=0,R=-1;
    int s=0;
    int x=-1,y=-1;
    while(1){
        if(s<l){
            R++;
            if(R==n)break;
            s+=vc[R].ff;
        }
        else if(l<=s and s<=u){
            x=L;
            y=R;
            break;
        }
        else{
            s-=vc[L].ff;
            L++;
        }
        
    }
    vector<int>ans;
    if(x==y and x==-1)return ans;
    for(int i=x;i<=y;i++){
        ans.pb(vc[i].ss);
    }
    return ans;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccgTKSF0.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