# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1002008 | ayankarimova | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 440 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 ll long long
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int>ans;
vector<pair<ll, ll>>v;
ll n=w.size();
for(int i=0; i<w.size(); i++){
v.push_back({w[i], i});
}
ll k=0;
ll r=1, sum=v[0].first;
sort(v.begin(), v.end());
while(k<n){
while(r<n && sum<l){
sum+=v[r++].first;
}
if(sum>=l && sum<=u){
for(int j=k; j<r; j++){
ans.push_back(v[j].second);
//cout<<v[j].second<<' ';
}
return ans;
}
sum-=v[k].first;;
k++;
}
return ans;
}
/*
{} []
7
13 14
2 2 3 3 3 4 4
*/
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... |