Submission #670959

#TimeUsernameProblemLanguageResultExecution timeMemory
670959mdubDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { sort(w.begin(), w.end()); int left = 0; int sum = 0; for (int right = 0; right < w.size(); right++) { sum += w[right]; while (sum > u) { sum -= w[left]; left++; } if (sum >= l) { vector<int> ret; for (int i = left; i <= right; i++) { ret.push_back(w[i]); } return ret; } } return {}; }

Compilation message (stderr)

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