# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
779413 | JoenPoenMan | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 212 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;
#define fullVec(arr) arr.begin(), arr.end()
typedef pair<int, int> ii;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int> subset;
vector<ii> sw;
for (int i = 0; i < w.size(); i++) {
sw.push_back({w[i], i});
}
sort(fullVec(sw));
int sum = 0;
for (int i = sw.size()-1; i >= 0; i--) {
if (u-(sw[i].first + sum) >= sw[0].first) {
subset.push_back(sw[i].second);
sum += sw[i].first;
if (sum >= l) return subset;
}
}
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... |