Submission #88628

#TimeUsernameProblemLanguageResultExecution timeMemory
88628NucleistDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, std::vector<int> w) { int k = w.size(); int f = l; l=u; int n = k; vector <int> kk; int sum = max(f,l); bool subset[k+1][max(f,l)+1]; for (int i = 0; i <= n; i++) subset[i][0] = true; for (int i = 1; i <= sum; i++) subset[0][i] = false; for (int i = 1; i <= n; i++) { for (int j = 1; j <= sum; j++) { if(j<w[i-1]) subset[i][j] = subset[i-1][j]; if (j >= w[i-1]) subset[i][j] = subset[i-1][j] || subset[i - 1][j-w[i-1]]; } } bool ka = false; for (int j = min(l,f); j <= max(l,f); j++) { int kaa=j; if(subset[n][j]) { for(int i = n;i>=1;i--) { if(subset[i-1][kaa-w[i-1]]) { kk.push_back(w[i-1]); kaa -= w[i-1]; compteur++; ka=true; if(kaa==0) break; } } } if(ka) break; } return std::vector<int>kk; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:41:21: error: 'compteur' was not declared in this scope
                     compteur++;
                     ^~~~~~~~
molecules.cpp:41:21: note: suggested alternative: 'toupper'
                     compteur++;
                     ^~~~~~~~
                     toupper
molecules.cpp:51:28: error: expected primary-expression before 'kk'
     return std::vector<int>kk;
                            ^~
molecules.cpp:51:28: error: expected ';' before 'kk'
molecules.cpp:51:30: warning: statement has no effect [-Wunused-value]
     return std::vector<int>kk;
                              ^