# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1119488 | Marszpace | Detecting Molecules (IOI16_molecules) | C++14 | 41 ms | 5776 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) {
vector<pair<int,int>> p;
for(int i=0;i<w.size();i++){
p.push_back({w[i],i});
}
sort(p.begin(),p.end(),greater<pair<int,int>>());
int sum=0;
queue<int> qq;
for(auto [wi,pos]:p){
sum+=wi;
qq.push(pos);
if(l<=sum&&sum<=u){
vector<int> ans;
while(!qq.empty()){
ans.push_back(qq.front());
qq.pop();
}
return ans;
}
else{
while(sum>u){
sum-=w[qq.front()];
qq.pop();
}
}
}
return 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... |