# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
210541 | bash | Detecting Molecules (IOI16_molecules) | C++17 | 75 ms | 6252 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"
#define weight first
#define num second
using namespace std;
typedef long long LL;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<pair<int ,int > > v;
vector<int > ans;
for(int i=0;i<w.size();i++)
v.push_back({w[i],i});
sort(v.begin(),v.end());
LL sum = 0;
for(int i=0,j = 0;i<v.size();i++){
sum+=v[i].weight;
while(sum>u) sum-=v[j++].first;
if(sum>=l && sum<=u){
for(;j<=i;j++)
ans.push_back(v[j].second);
sort(ans.begin(),ans.end());
break;
}
}
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... |