Submission #642547

#TimeUsernameProblemLanguageResultExecution timeMemory
642547rc_catuntaDetecting Molecules (IOI16_molecules)C++17
31 / 100
1090 ms596 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; vector<int> find_subset(int l, int u, vector<int> w) { vector<ii> v; for(int i=0;i<w.size();i++){ v.push_back(ii(w[i],i)); } sort(v.begin(),v.end()); vector<int> res; int sum = 0; // Super Fuerza Bruta for(int i=0;i<w.size();i++){ for(int j=0;j<w.size();j++){ res.clear(); sum = 0; for(int k=i;k<=j;k++){ sum += v[k].first; res.push_back(v[k].second); } if(sum>=l and sum<=u){ return res; } } } res.clear(); return res; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:10:18: 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++){
      |                 ~^~~~~~~~~
molecules.cpp:17:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
molecules.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for(int j=0;j<w.size();j++){
      |                     ~^~~~~~~~~
#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...