# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1119489 | Marszpace | Detecting Molecules (IOI16_molecules) | C++14 | 43 ms | 10580 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;
#define int long long
vector<signed> find_subset(signed l, signed u, vector<signed> 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=(int)0;
queue<int> qq;
for(auto [wi,pos]:p){
sum+=wi;
qq.push(pos);
if(l<=sum&&sum<=u){
vector<signed> 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<signed>(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... |