# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
93472 | tpoppo | Detecting Molecules (IOI16_molecules) | C++14 | 52 ms | 7164 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;
using ll = long long;
using pii = pair<ll,int>;
vector<int> res;
vector<pii> v;
vector<int> find_subset(int lw, int u, vector<int> w) {
v.reserve(w.size());
for(int i=0;i<w.size();i++){
v.emplace_back(w[i],i);
}
sort(v.begin(),v.end());
int l = 0;
ll sum = 0;
for(int r = 0;r < v.size();r++){
sum += v[r].first;
while(sum > u){
sum -= v[l].first;
l++;
}
//cout<<l<<" - "<<r<<": "<<sum<<endl;
if(sum >= lw){
for(int i = l;i<=r;i++) res.push_back(v[i].second);
return res;
}
}
return vector<int>();
}
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... |