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>
#define endl "\n"
#define yeap cout<<"YES"<<endl
#define nope cout<<"NO"<<endl
#define ll long long
using namespace std;
#include "molecules.h"
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
ll n = w.size();
ll arr[n+1];
arr[0] = 0;
for(int i=0; i<n; i++){
arr[i+1] = arr[i]+w[i];
}
ll q = -1;
vector<int> ans;
for(int i=0; i<n; i++){
for(int j=i; j<n; j++){
ll a = arr[i-1];
ll b = arr[j];
ll c = b-a;
if(c>=l && c<=u){
q=1;
for(int k=i; k<=j; k++){
ans.push_back(w[k]);
}
}
}
}
if(q==-1){
return std::vector<int>(0);
} else {
return ans;
}
}
# | 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... |