Submission #860846

#TimeUsernameProblemLanguageResultExecution timeMemory
860846JoksimKaktusDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms600 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector <bool> tab(u+1,false); tab[0]=true; vector <set<int>> ind(u+1); int stop = -1; for(int i = 0;i < w.size();i++){ for(int j = u;j -w[i] >= 0;j--){ if(tab[j-w[i]] && !tab[j]){ tab[j]=true; ind[j].insert(i); if(j >= l){ stop = j; break; } } } if(stop > -1){ break; } } if(stop > -1){ vector <int>res; for(auto i : ind[stop]){ res.push_back(i); } return res; }else{ return {}; } }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:11:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i = 0;i < w.size();i++){
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...