Submission #362119

#TimeUsernameProblemLanguageResultExecution timeMemory
362119penguinhackerDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array int find_subset(int l, int r, int w[], int n, int res[]) { vector<pair<int, int>> v(n); for (int i = 0; i < n; ++i) { v[i].first = w[i]; v[i].second = i; } sort(v.begin(), v.end()); if (accumulate(w, w + n, 0ll) < l) return 0; ll cur = 0; int ind = 0; for (; cur < l; ++ind) { cur += v[ind].first; } assert(cur >= l); cur -= v[--ind].first; assert(cur < l); vector<int> d(ind); iota(d.begin(), d.end(), 0); for (int i = ind - 1; i >= 0; --i) { cur += v[n + i - ind].first - v[i].first; d[i] = n + i - ind; assert(cur <= r); if (cur >= l) break; } assert(cur <= r); if (cur < l) return 0; for (int i = 0; i < ind; ++i) { res[i] = v[d[i]].second; } return ind; } int n, l, r, w[200000], res[200000]; /*int main() { ios::sync_with_stdio(0); cin.tie(0); n = 4; l = 15; r = 17; w[0] = 6; w[1] = 8; w[2] = 8; w[3] = 7; cout << find_subset(l, r, w, n, res) << "\n"; for (int i = 0; i < 3; ++i) cout << res[i] << " "; return 0; }*/

Compilation message (stderr)

/tmp/ccOTmh0z.o: In function `main':
grader.cpp:(.text.startup+0x139): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status