Submission #853180

#TimeUsernameProblemLanguageResultExecution timeMemory
853180parsadox2Detecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long using namespace std; vector <int> find_subset(int l , int r , vector <int> t) { vector <pair<int ,int>> ar; int n = t.size(); for(int i = 0 ; i < n ; i++) ar.push_back({t[i] , i + 1}); sort(ar.begin() , ar.end()); vector <int> res; int num = 0 , sum = 0; for(int i = n - 1 ; i > -1 ; i--) { sum += ar[i].first; num++; if(sum >= l) break; } num--; if(sum < l) return res; int sum2 = 0; for(int i = 0 ; i <= num ; i++) sum2 += ar[i].first; if(sum2 > r) return res; int las = n - 1; while(sum2 < l) { sum2 += (ar[las].first - ar[num].first); num--; res.push_back(ar[las].second); las--; } for(int i = num ; i >= 0 ; i--) res.push_back(ar[i].second); reverse(res.begin() , res.end()); return res; }

Compilation message (stderr)

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