# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
297754 | emnik | 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 <bits/stdc++.h>
#include "molecules.h"
using namespace std;
#define pb push_back
#define all(x) begin(x), end(x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int find_subsets(int l, int r, int w[], int n, int result[]){
vector<int> a, b;
for(int i=1; i <= n; i++){
int sum=w[i], flag=0;
a.clear();
a.pb(i);
for(int j=i+1; j <= n; j++){
if(sum >= l && sum <= r){
flag=1;
break;
}
sum+= w[j];
a.pb(j);
}
if(flag) b = a;
}
for(int i=0; i < b.size(); i++){
result[i+1]=b[i];
}
return (int)b.size();
}