Submission #717601

#TimeUsernameProblemLanguageResultExecution timeMemory
717601ToxtaqDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int r, vector<int>&w){ int n = w.size(); vector<bool>table(r + 1); vector<int>par(r + 1, -1); table[0] = 1; for(int i = 0;i < n;++i){ for(int j = r;j >= 1;--j){ if(j - w[i] >= 0 && table[j - w[i]]){ table[j] = 1; par[j] = i; } } } int num = -1; for(int i = l;i <= r;++i){ if(table[i]){ num = i; break; } } vector<int>ans; if(num < 0)return ans; while(par[num] != -1){ ans.push_back(par[num]); num -= w[par[num]]; } return ans; } //int main() //{ // int l, r, n; // cin >> l >> r >> n; // vector<int>v(n); // for(int i = 0;i < n;++i)cin >> v[i]; // vector<int>ans = find_subset(l, r, v); // for(int i : ans)cout << i << " "; //}

Compilation message (stderr)

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