# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
433448 | bipartite_matching | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 204 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 <bits/stdc++.h>
#define forint(i, N) for (int i = 0; i < (N); i++)
using namespace std;
typedef long long ll;
vector<int> find_subset(int l, int u, vector<int> w) {
//sort(w.begin(), w.end());
vector< pair<int, int> > v(w.size());
forint(i, w.size()) {
v[i] = {w[i], i};
}
sort(v.begin(), v.end());
vector<int> ans;
int k = 1;
int f = 0;
ll sum = v[0].first;
while (sum < l && k < v.size()) {
sum += (ll)v[k].first;
if (sum > u) {
sum -= (ll)v[f].first;
f++;
}
k++;
}
if (sum < l) {
return ans;
}
else {
ans.resize(k - f);
for (int i = f; i < k; i++) {
ans[i - f] = v[i].second;
}
sort(ans.begin(), ans.end());
return ans;
}
}
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... |