Submission #658065

#TimeUsernameProblemLanguageResultExecution timeMemory
658065kussssoDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; #define int long long vector<int> find_subset (int l, int u, vector<int> w) { vector<int> res; vector<pair<int, int>> v; int n = w.size(); for (int i = 0; i < n; i++) { v.push_back({w[i], i}); } sort(v.begin(), v.end()); vector<int> pf(n, 0); vector<int> sf(n + 1, 0); for (int i = 0; i < n; i++) { pf[i] = (i == 0 ? 0 : pf[i - 1]) + v[i].first; } for (int i = n - 1; i >= 0; i--) { sf[i] = sf[i + 1] + v[i].first; } for (int len = 1; len <= n; len++) { if (pf[len - 1] >= l or sf[n - len] >= l) { if (pf[len - 1] > u) return {}; for (int i = 0; i + len - 1 < n; i++) { int sum = pf[i + len - 1] - (i == 0 ? 0 : pf[i - 1]); if (l <= sum and sum <= u) { for (int j = i; j < i + len; j++) { res.push_back(v[j].second); } return res; } } } } return {}; }

Compilation message (stderr)

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