Submission #878888

#TimeUsernameProblemLanguageResultExecution timeMemory
878888GrayDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
// Source: https://usaco.guide/general/io #include <bits/stdc++.h> #include <cassert> #define ll long long #define ln "\n" #define ff first #define ss second #define ld long double const ll INF = 2e18; const ll MOD = 1e9+7; using namespace std; int find_subset(int l, int u, int w[], int n, int result[]){ vector<pair<ll, ll>> bw(n); for (ll i=0; i<n; i++){ bw[i] = {w[i], i}; } sort(bw.rbegin(), bw.rend()); vector<ll> ind; ll sum = 0; ll cp = 0; while (cp<n and sum+bw[cp].ff<=u){ ind.push_back(bw[cp].ss); sum+=bw[cp].ff; cp++; } ll ccp = n-1; while (ccp>cp and sum+bw[ccp].ff<=l){ ind.push_back(bw[ccp].ss); sum+=bw[ccp].ff; ccp--; } if (sum>=l and sum<=u){ for (ll i=0; i<(int)ind.size(); i++){ result[i] = (int)(ind[i]); } return (int)ind.size(); }else return 0; }

Compilation message (stderr)

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