Submission #611057

#TimeUsernameProblemLanguageResultExecution timeMemory
611057TemmieDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms304 KiB
#include <bits/stdc++.h> inline std::vector <int> make(int l, int r) { std::vector <int> res(r - l + 1); std::iota(res.begin(), res.end(), l); return res; } std::vector <int> find_subset(int l, int u, std::vector <int> w) { std::sort(w.begin(), w.end()); long long sum = 0; int n = w.size(); for (int i = 0; i < n; i++) { sum += w[i]; if (sum >= l && sum <= u) { return make(0, i); } if (sum > l) { for (int j = 0; j < i; j++) { sum -= w[j]; if (sum >= l && sum <= u) { return make(j + 1, i); } } break; } } 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...