Submission #840177

#TimeUsernameProblemLanguageResultExecution timeMemory
840177sleepntsheepDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <algorithm> #include <set> #include <deque> int find_subset(int l, int u, int *w, int n, int *result) { std::sort(w, w+n); int s = 0, i; std::multiset<int> sub; std::deque<int> lo, hi; for (i = 0; i < n; ++i) if (s + w[i] < l) s += w[i], lo.push_back(w[i]), sub.insert(i); else break; for (int j = i; j < n; ++j) hi.push_back(w[j]); while (s < l && lo.size() && hi.size()) { int d = hi.front() - lo.front(); s += d; sub.erase(sub.find(lo.front())); sub.insert(hi.front()); hi.pop_front(); lo.pop_front(); } if (s < l) return 0; int j = 0; for (auto x : sub) result[j++] = x; return j; }

Compilation message (stderr)

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