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>
using namespace std;
vector<int> find_subset(int l, int r, vector<int> a) {
int n=a.size();
bool vis[r+1]={0};
queue<int> q[2];
vis[0]=1;
q[0].push(0);
int index=0;
vector<int> rez;
for (int i=0;i<n;i++) {
while (!q[index].empty()) {
int zbir=q[index].front();
q[index].pop();
q[1-index].push(zbir);
int nov_zbir=zbir+a[i];
if (nov_zbir>=l&&nov_zbir<=r) {
for (int j=0;j<=i;j++) {
if (vis[nov_zbir-a[j]])
nov_zbir-=a[j], rez.push_back(j);
}
return rez;
}
if (nov_zbir>r||vis[nov_zbir]) continue;
q[1-index].push(nov_zbir);
vis[nov_zbir]=1;
}
index=1-index;
}
return rez;
}
# | 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... |