Submission #600417

#TimeUsernameProblemLanguageResultExecution timeMemory
600417A_DDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms304 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> vec; vector<pair<int,int>> s; for(int i=0;i<w.size();i++){ s.push_back({w[i],i}); } sort(s.begin(),s.end()); int sum=0; for(int i=s.size()-1;i>=0;i--){ if(sum+s[i].first<=u){ sum+=s[i].first; vec.push_back(s[i].second); } } if(sum<l){ vec.clear(); } sort(vec.begin(),vec.end()); return vec; }

Compilation message (stderr)

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