# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773367 | Matblube | 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 <iostream>
#include <iomanip>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
sort(w.begin(), w.end());
int a, b, cc, pos;
std::vector<int>result;
a=b=cc=pos=0;
while(1){
if(b>=n || a>=n) break;
if(cc<l){
cc+=w[a++]; continue;
}
if(cc>u){
cc-=w[b++]; continue;
}
for(int i=a; i<b ; i++){
result.push_back(w[i]);
}
return result;
}
return std::vector<int>(0);
}