# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1019841 | Salty | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 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>
#include "grader.cpp"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> ans,blank;
vector<int> temp;
temp = w;
sort(w.begin(),w.end());
unordered_map<int,int> mp;
for(auto val:w){
mp[val]++;
}
int w1 = w[0], w2 = w[w.size()-1];
int sm = 0;
for(int i = 0; i < mp[w1]; i++){
if(sm < l) {
sm+=w[i];
ans.push_back(i);
}
else break;
}
if(sm <= u) return ans;
else return blank;
}