Submission #697109

#TimeUsernameProblemLanguageResultExecution timeMemory
697109_Knyaz_Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w){ sort(w.begin(), w.end()); vector<int> zero = {0}; int sum = w[0], n = w.size(); if(l <= sum && sum <= u) return zero; int L = 0, R = 1; while(R<n){ if(sum<=u) sum += w[R++]; if(sum>u) sum -= w[L++]; if(l<=sum && sum<=u){ vector<int> vec; for(int i = L; i < R; i++) vec.push_back(i); return vec; } } }

Compilation message (stderr)

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