Submission #725375

#TimeUsernameProblemLanguageResultExecution timeMemory
725375AndrijaMDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int>arr; int n; int dp[105][1005]; int f(int idx,int x,vector<int>vec,vector<int>kolku) { if(idx==kolku.size()) { return 0; } if(dp[idx][x]!=-1)return dp[idx][x]; rez=max(rez, f(idx+1,x,vec,kolku)); if(x-kolku[idx]>=0) { vector<int>pom; pom=vec; pom.push_back(idx); rez=max(rez, f(idx+1,x-kolku[idx],pom,kolku)); } return dp[idx][x]=rez; } vector<int> find_subset(int l, int u, vector<int> w) { memset(dp,-1,sizeof dp); vector<int>v; queue<int>Q; n=w.size(); int kol=f(0,u,v,w); if(kol<l) { return {}; } return arr; }

Compilation message (stderr)

molecules.cpp: In function 'int f(int, int, std::vector<int>, std::vector<int>)':
molecules.cpp:11:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     if(idx==kolku.size())
      |        ~~~^~~~~~~~~~~~~~
molecules.cpp:16:5: error: 'rez' was not declared in this scope
   16 |     rez=max(rez, f(idx+1,x,vec,kolku));
      |     ^~~