# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
77092 | shoemakerjo | Detecting Molecules (IOI16_molecules) | C++14 | 72 ms | 33984 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>
#define ll long long
using namespace std;
#define pli pair<ll, int>
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pli> vs;
for (int i = 0; i < w.size(); i++) {
vs.push_back(pli(w[i], i));
}
sort(vs.begin(), vs.end());
if (vs[0].first > u) return {};
ll csum = 0LL;
int start = 0;
for (int i = 0; i < vs.size(); i++) {
if (csum + vs[i].first <= u) {
csum += vs[i].first;
if (csum >= l) {
vector<int> ans;
for (int j = start; j <= i; j++) {
ans.push_back(vs[j].second);
}
return ans;
}
continue;
}
csum += vs[i].first;
csum -= vs[start++].first;
if (csum >= l) {
vector<int> ans;
for (int j = start; j <= i; j++) {
ans.push_back(vs[j].second);
}
return ans;
}
}
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... |