Submission #788377

#TimeUsernameProblemLanguageResultExecution timeMemory
788377BulaDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define int ll const ll mod=1e9+7; vector<int> find_subset(int l,int u,vector<int> w){ int n=(int)w.size(); vector<int> v(n+1); for(int i=1;i<=n;i++) v[i]=w[i-1]; int dp[n+1][u+1]; for(int i=0;i<=n;i++){ for(int j=1;j<=u;j++){ dp[i][j]=0; } } vector<int> ans; for(int i=1;i<=n;i++){ for(int j=u;j>=1;j--){ if(dp[i-1][j]>0) dp[i][j]=1; if(j==v[i]) dp[i][j]=2; if(j>v[i]) dp[i][j]=max(dp[i][j],dp[i-1][j-v[i]]); } } int sum=0; for(int i=l;i<=u;i++){ if(dp[n][i]>0){ sum=i; break; } } int i=n; while(sum!=0){ if(dp[i][sum]==2){ sum-=v[i]; ans.pb(i-1); }else{ i--; } } return ans; }

Compilation message (stderr)

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