Submission #860856

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

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:10:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     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...