# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
849743 | chilengaming | 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<bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> ans;
vector<pair<int, int>> ww;
int i = 0;
for(int &a : w) {
ww.push_back({a, i});
i++;
}
sort(ww.begin(), ww.end());
while(ww.size() && ww.back().first > u) ww.pop_back();
if(!ww.size()) return ans;
int R = 0;
long long sum = ww[0].first;
for(int L = 0; L < ww.size(); L++) {
if(R < L) {
R = L;
sum = ww[L].first;
}
while(sum < l && R + 1 < ww.size()) {
R++;
sum += ww[0].first;
}
if(sum >= l && sum <= u) {
for(int j = L; j <= R; j++) {
ans.push_back(ww[j].second);
}
return ans;
}
sum -= ww[L].first;
}
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... |