# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810801 | wortelworm | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 300 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"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
std::vector<int> find_subset(int lower, int upper, std::vector<int> wOriginal) {
ll sum = 0;
// size, index
vector<pair<int, int>> weights(wOriginal.size());
for (int i = 0; i < wOriginal.size(); i++) {
weights[i] = {wOriginal[i], i};
}
sort(weights.rbegin(), weights.rend());
vector<int> answer;
for (int i = 0; i < weights.size(); i++) {
auto [w, index] = weights[i];
sum += w;
answer.push_back(index);
if (sum >= lower) {
if (sum > upper) {
return {};
}
return answer;
}
}
return {};
}
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... |