Submission #632516

#TimeUsernameProblemLanguageResultExecution timeMemory
632516StavabDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms288 KiB
#include "molecules.h" #include <algorithm> #include <utility> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int, int>> v; for(int i = 0; i < w.size(); i++) v.push_back(make_pair(w[i], i)); sort(w.begin(), w.end()); int sum = 0; int i, j = 0; for(i = 0; i < w.size(); i++) { sum += w[i]; while(sum > u) { sum -= w[j]; j++; } if(l <= sum && sum <= u) break; } if(i == w.size()) return {}; vector<int> ind; for(int z = j; z <= i; z++) ind.push_back(v[z].second); return ind; }

Compilation message (stderr)

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