Submission #935792

#TimeUsernameProblemLanguageResultExecution timeMemory
935792SpyrosAlivDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> vector<int> ans(int l, int r, vector<pll> w) { vector<int> a; for (int i = l; i < r; i++) { a.push_back(w[i].second); } return a; } vector<int> find_subset(ll lb, ll ub, vector<ll> w) { int n = w.size(); vector<pll> arr; for (int i = 0; i < n; i++) { arr.push_back({w[i], i}); } sort(arr.begin(), arr.end()); int l = 0, r = 0; ll currSum = 0; while (r < n) { while (currSum < lb && r < n) { currSum += arr[r++].first; } while (currSum > ub && l < r) { currSum -= arr[l++].first; } if (currSum >= lb && currSum <= ub) { return ans(l, r, arr); } if (r < n) currSum += arr[r++].first; } return {}; }

Compilation message (stderr)

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