Submission #491944

#TimeUsernameProblemLanguageResultExecution timeMemory
491944VirvDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms332 KiB
#include <algorithm> #include <cstdint> #include <vector> #include "molecules.h" std::vector<int> find_subset(int l, int u, std::vector<int> w) { sort(w.begin(), w.end()); int T{}; std::vector<int> S{}; size_t i{}; while (i < w.size() && T + w[i] <= u) { T += w[i]; S.push_back(i); ++i; } while (i < w.size() && T < l) { T += w[i] - w[S[i % S.size()]]; S[i % S.size()] = i; ++i; } return l <= T && T <= u ? S : std::vector<int>{}; }
#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...