# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773363 | 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 <iostream>
#include <iomanip>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
int find_subset(int l, int u, int w[], int n, int result[]){
sort(w, w+n);
int a, b, cc=0, pos=0;
a=b=0;
while(1){
if(b>=n || a>=n) break;
if(cc<l){
cc+=w[a++]; continue;
}
else if(cc>u){
cc-=w[b++]; continue;
}
for(int i=a ; i<b ; i++){
result[pos++]=w[i];
}
return a-b;
}
return 0;
}