Submission #867284

#TimeUsernameProblemLanguageResultExecution timeMemory
867284AtabayRajabliDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> #define int long long using namespace std; std::vector<int> find_subset(int L, int U, std::vector<int> w) { int n = w.size(); std::vector<pair<int, int>> v(n); for(int i = 0; i<n; i++) { v[i] = make_pair(w[i], i); } sort(v.begin(), v.end()); set<int> s; int l = 0, r = 0, sum = 0; while(r < n) { sum += v[r].first; s.insert(v[r].second); while(l <= r && sum > U) { sum -= v[l].first; s.erase(v[l].second); l++; } if(L <= sum && sum <= U) { vector<int> ans; for(int i : s)ans.push_back(i); return ans; } r++; } return std::vector<int>(0); }

Compilation message (stderr)

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