# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
790515 | Andrey | Detecting Molecules (IOI16_molecules) | C++14 | 41 ms | 9024 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;
vector<int> find_subset(int l, int u, vector<int> w) {
queue<pair<long long,long long>> idk;
vector<pair<long long,long long>> haha(0);
for(long long i = 0; i < w.size(); i++) {
haha.push_back({w[i],i});
}
sort(haha.begin(),haha.end());
long long sb = 0,a;
for(long long i = 0; i < w.size(); i++) {
a = haha[i].first;
sb+=a;
idk.push(haha[i]);
while(sb > u) {
sb-=idk.front().first;
idk.pop();
}
if(sb <= u && sb >= l) {
break;
}
}
if(sb > u || sb < l) {
return vector<int> (0);
}
vector<int> ans(0);
while(!idk.empty()) {
ans.push_back(idk.front().second);
idk.pop();
}
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... |