Submission #156458

#TimeUsernameProblemLanguageResultExecution timeMemory
156458a_playerDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define f first #define s second #define mp make_pair #define pb push_back using namespace std; typedef long long ll; pair<int,int> dp[1001]; vector<int> find_subset(int l,int u,vector<int> w){ int N=w.size(); dp[0].f=1; dp[0].s=-1; for(int i=0;i<N;i++) for(int j=l;j>=0;j--) if(j-v[i]>=0)if(dp[j-v[i]].f)dp[j]=mp(1,i); int t=-1; for(int i=u;i<=l;i++)if(dp[i].f){ t=i; break; }vector<int> sol; if(t==-1)return sol; while(dp[t].s!=-1){ sol.push_back(dp[t].s); t-=v[dp[t].s]; } return sol; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:20:8: error: 'v' was not declared in this scope
   if(j-v[i]>=0)if(dp[j-v[i]].f)dp[j]=mp(1,i);
        ^
molecules.cpp:19:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int j=l;j>=0;j--)
  ^~~
molecules.cpp:21:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   int t=-1;
   ^~~
molecules.cpp:29:8: error: 'v' was not declared in this scope
     t-=v[dp[t].s];
        ^