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 <algorithm>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = int(w.size());
int a = 1000;
int b = 0;
for (int i = 0; i < n; i++) {
a = min(a, w[i]);
b = max(b, w[i]);
}
vector<int> ai;
vector<int> bi;
for (int i = 0; i < n; i++) {
if (w[i] == a) ai.push_back(i);
else bi.push_back(i);
}
for (int i = 0; i < int(ai.size())+1; i++) {
for (int j = 0; j < int(bi.size())+1; j++) {
int s = i*a + j*b;
//printf("%d %d %d\n", i, j, s);
if (s >= l && s <= u) {
vector<int> result;
for (int k = 0; k < i; k++) {
result.push_back(ai[k]);
}
for (int k = 0; k < j; k++) {
result.push_back(bi[k]);
}
return result;
}
}
}
return vector<int>(0);
}
# | 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... |