Submission #70174

#TimeUsernameProblemLanguageResultExecution timeMemory
70174VahanDetecting Molecules (IOI16_molecules)C++17
9 / 100
4 ms632 KiB
#include "molecules.h" #include<algorithm> #include<vector> using namespace std; vector<int> g1,g2; vector<pair<int,int> > v; std::vector<int> find_subset(int l, int u, std::vector<int> w) { for(int i=0;i<w.size();i++) v.push_back({w[i],i}); sort(v.begin(),v.end()); long long s=0; for(int i=0;i<v.size();i++) { s+=v[i].first; g1.push_back(v[i].second); if(s>=l && s<=u) return g1; if(s>u) break; } s=0; for(int i=v.size()-1;i>=0;i--) { s+=v[i].first; g2.push_back(v[i].second); if(s>=l && s<=u) return g2; if(s>u) break; } return std::vector<int>(0); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<w.size();i++)
                 ~^~~~~~~~~
molecules.cpp:12:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v.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...