Submission #493673

#TimeUsernameProblemLanguageResultExecution timeMemory
493673IwanttobreakfreeDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <iostream> #include <vector> #include <algorithm> using namespace std; #define int long long vector<int> find_subset(int l, int u, vector<int> w) { int n=w.size(); vector<pair<int,int> >mol(n); for(int i=0;i<n;i++)mol[i]={w[i],i}; sort(mol.begin(),mol.end()); int ans=0,j=0; for(int i=0;i<n;i++){ while(j<n&&mol[j].first+ans<=u){ ans+=mol[j].first; j++; } //cout<<ans<<' '; if(ans>=l){ vector<int> sol; for(int k=i;k<j;k++)sol.push_back(mol[k].second); return sol; } ans-=mol[i].first; } return vector<int>(0); } /*int main(){ vector<int> v={5,5,6,6}; int l=15,r=16; vector<int> ans=find_subset(l,r,v); for(int x:ans)cout<<x<<' '; } */

Compilation message (stderr)

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