Submission #853065

#TimeUsernameProblemLanguageResultExecution timeMemory
853065_uros9Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" #define endl '\n' #define int long long using namespace std; const long long longlongmax=9223372036854775807; const int modul=998244353; const long long mod = 1e9 + 7; vector<int> find_subset(int l,int u,vector<int> w){ int n=w.size(); vector<int> rez(0); vector<pair<int,int>> niz(n); for(int i=0; i<n; i++) niz[i]={w[i],i}; sort(niz.begin(),niz.end()); if(niz[0].first>u) return rez; vector<int> pref(n+1,0); for(int i=0; i<n; i++){ pref[i+1]=pref[i]; pref[i+1]+=niz[i].first; } bool ok=false; int ll,dd; pref.push_back(1e15); /*for(auto x:pref) cout << x << " "; cout << endl;*/ for(int i=0; i<n&&!ok; i++){ int ind=lower_bound(pref.begin(),pref.end(),pref[i]+l)-pref.begin(); //cout << pref[i] << " " << pref[ind] << endl; if(pref[ind]-pref[i]>u) continue; ok=true; ll=i; dd=ind; } if(!ok) return rez; for(int i=ll; i<=dd-1; i++) rez.push_back(niz[i].second); return rez; }

Compilation message (stderr)

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