Submission #81771

#TimeUsernameProblemLanguageResultExecution timeMemory
81771AngelKnowsDetecting Molecules (IOI16_molecules)C++14
0 / 100
2 ms516 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; const int inf=0x3f3f3f3f; std::vector<int> find_subset(int l, int u, std::vector<int> w) { sort(w.begin(),w.end()); vector<int> ans; int L=l,R=u; if (L<=w[0]&&w[0]<=R) { ans.push_back(w[0]); return ans; } else if (w[0]>R) { return vector<int>(0); } else if (w[0]<L) { int t=w.back(); if (L<=t&&t<=R) { ans.push_back(t); return ans; } else if (t<L) { long long sum=0; for (int i=0;i<w.size();i++) { sum+=w[i]; ans.push_back(w[i]); if (L<=sum&&sum<=R) { return ans; } } return vector<int>(0); } } }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:22:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i=0;i<w.size();i++) {
                 ~^~~~~~~~~
molecules.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...