Submission #574061

#TimeUsernameProblemLanguageResultExecution timeMemory
574061EliasDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #ifndef _DEBUG #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx") #include "molecules.h" #endif using namespace std; #define int int64_t vector<int> find_subset(int l, int u, vector<int> w) { vector<int> a; for (int x : w) { if (x > u) continue; if (x >= l) return {x}; a.push_back(x); } int n = a.size(); vector<vector<bool>> dp(n + 1, vector<bool>(u + 1)); for (int i = 0; i <= n; i++) dp[i][0] = 1; int i, j; for (i = 1; i <= n; i++) for (j = 1; j <= u; j++) { dp[i][j] = dp[i - 1][j]; if (a[i - 1] <= j) dp[i][j] = dp[i][j] | dp[i - 1][j - a[i - 1]]; if (j >= l && dp[i][j]) goto out; } return {}; out: vector<int> o; while (i) { if (!dp[i - 1][j]) { o.push_back(a[i - 1]); j -= a[i - 1]; } i--; } return o; } #ifdef _DEBUG signed main() { int n, l, u; cin >> n >> l >> u; vector<int> a(n); for (int &x : a) cin >> x; for (int x : find_subset(l, u, a)) cout << x << " "; } #endif

Compilation message (stderr)

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