제출 #491954

#제출 시각아이디문제언어결과실행 시간메모리
491954VirvDetecting Molecules (IOI16_molecules)C++17
69 / 100
36 ms2604 KiB
#include <algorithm> #include <cstdint> #include <numeric> #include <vector> #include "molecules.h" std::vector<int> find_subset(int l, int u, std::vector<int> w) { std::vector<uint32_t> p(w.size()); iota(p.begin(), p.end(), 0); sort(p.begin(), p.end(), [&](auto a, auto b) { return w[a] < w[b]; }); int T{}; size_t i{}, j{}; for (;;) { if (l <= T && T <= u) { return std::vector<int>(p.begin() + i, p.begin() + j); } if (T < l && j < p.size()) { T += w[p[j++]]; } else if (T > u && i < j) { T -= w[p[i++]]; } else { return {}; } } }
#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...