Submission #101981

#TimeUsernameProblemLanguageResultExecution timeMemory
101981tim25871014Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> solve(int l,int u,vector<int> w){ int dp[10010]; fill(dp,dp+10010,-1); dp[0]=0; for(int i=0;i<w.size();i++) for(int j=u;j>=0;j--){ if(j-w[i]>=0 && dp[j-w[i]]!=-1) if(dp[j]==-1) dp[j]=i; } vector<int> ans; for(int i=l;i<=u;i++) if(dp[i]!=-1){ int now=i; while(now!=0){ ans.push_back(dp[now]); now-=w[dp[now]]; } return ans; } return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> solve(int, int, std::vector<int>)':
molecules.cpp:10:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<w.size();i++)
                 ~^~~~~~~~~
/tmp/ccgOc8nm.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status