Submission #651342

#TimeUsernameProblemLanguageResultExecution timeMemory
651342ayallaDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define int long long int #define endl '\n' #define pb push_back #define pi pair<int, int> #define pii pair<int, pi> #define fir first #define sec second #define MAXN 500001 #define mod 1000000007 vector<int> find_subset(int l, int u, vector<int> w) { int r = u; int n = w.size(); set<pi> s; int sum = 0; for (int i = 0; i < n; i++) { s.insert({w[i], i}); sum += w[i]; } vector<bool> vis(n, 1); while (sum > r) { int dif = sum - r; auto it = s.lower_bound({dif, -1}); if (it != s.end() && (sum - (*it).fir) >= l && (sum - (*it).fir) <= r) { pi x = *it; sum -= x.fir; vis[x.sec] = 0; break; } else { pi x = *s.begin(); sum -= x.fir; vis[x.sec] = 0; s.erase(x); } } vector<int> ans; if (sum < l) return ans; for (int i = 0; i < n; i++) { if (vis[i]) ans.pb(i); } return ans; }

Compilation message (stderr)

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