Submission #394140

#TimeUsernameProblemLanguageResultExecution timeMemory
394140TsvetelinaDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms204 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int t=w.size(); vector <int> otg; sort (w.begin(), w.end()); if (w[0]>u) { return otg; } if (w[0]>=l && w[0]<=u) { otg.push_back(w[0]); return otg; } otg.push_back(w[0]); int sum=w[0]; for (int i=1; i<t; i++) { sum=sum+w[i]; otg.push_back(w[i]); if (sum>=l) { return otg; } } }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
#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...