# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959415 | Mystic03 | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int p1 = 0;
int r = 0;
int currSum = 0;
while (currSum < l) {
currSum += w[r];
r++;
}
if (currSum <= u) {
return std::vector<int>(w.begin(), w.begin() + r);
}
r--;
currSum -= w[r];
for (int i = r; i < w.size(); i++) {
currSum += w[i];
currSum -= w[p1++];
if (currSum >= l && currSum <= u) {
return std::vector<int>(w.begin() + p1, w.end() + i + 1);
}
}
return std::vector<int>(0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |