Submission #888104

#TimeUsernameProblemLanguageResultExecution timeMemory
888104oblantisDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" #define all(v) v.begin(), v.end() #define pb push_back #define ss second #define ff first #define vt vector using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, int> pdi; const int inf = 1e9 + 10000; const int mod = 1e9+7; const int maxn = 5e5 + 12; #define int long long vector<ll> find_subset(int l, int u, vector<int> w) { int n = w.size(); vll ans, ns; int s = 0, j = 0, o = n - 1; pair<int, int> p[n]; for(auto i : w) { if(i >= l && i <= u) { return {j}; } if(s < l)s += i; p[j] = {i, j}; j++; } if(s < l) return ans; sort(p, p + n); s = j = 0; if(p[0].ff > u || n == 1)return ans; if(p[0].ff + p[1].ff > u) { return ans; } while(j < n && s + p[j].ff <= u) { ans.pb(p[j].ss); s += p[j].ff; j++; } if(s >= l) return ans; j--; while(j >= 0 && s <= l) { s -= p[j].ff; s += p[o].ff; ns.push_back(p[o].ss); o--; j--; ans.pop_back(); } if(s >= l){ ans.insert(ans.end(), all(ns)); return ans; } return vll(0); }

Compilation message (stderr)

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