Submission #923589

#TimeUsernameProblemLanguageResultExecution timeMemory
923589velislavgarkovDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <iostream> #include <vector> #include <algorithm> using namespace std; const int MAXN=1e5+10; pair <long long, int> a[MAXN]; long long pref[MAXN], n; vector <int> find_subset(long long lef, long long u, vector <int> w) { n=w.size(); pref[0]=0; for (int i=1;i<=n;i++) { a[i].first=w[i-1]; a[i].second=i-1; } sort(a+1,a+n+1); for (int i=1;i<=n;i++) pref[i]=a[i].first+pref[i-1]; vector <int> ans; for (int i=1;i<=n;i++) { int l, r, mid; l=1; r=i; while (l<=r) { mid=(l+r)/2; if (pref[i]-pref[mid-1]<lef) r=mid-1; else l=mid+1; } if (r>0 && pref[i]-pref[r-1]<=u && pref[i]-pref[r-1]>=lef) { //cout << i << ' ' << r << ' ' << pref[i]-pref[r-1] << endl; for (int j=r;j<=i;j++) ans.push_back(a[j].second); return ans; } } return ans; }

Compilation message (stderr)

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