Submission #526983

#TimeUsernameProblemLanguageResultExecution timeMemory
526983lcs147Detecting Molecules (IOI16_molecules)C++98
Compilation error
0 ms0 KiB
#include"molecules.h" #include<bits/stdc++.h> #define int long long using namespace std; vector<int>find_subset(int l, int r, vector<int> w) { if(l > r) return {}; int n = w.size(); vector<vector<bool>>pd(n+1, vector<bool>(r)); for(int i=l; i<=r; i++) pd[n][i] = true; for(int i=n-1; i>=0; i--) { for(int j=0; j<=r; j++) { pd[i][j] = pd[i+1][j]; if(j + w[i] <= r) pd[i][j] = (pd[i+1][j] || pd[i+1][j+w[i]]); } } int i=0, j=0; vector<int>res; while(i<n) { if(!pd[i][j]) return {}; if(pd[i][j] != pd[i+1][j]) { res.push_back(i); j += w[i]; } i++; } return res; }

Compilation message (stderr)

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