이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <iostream>
#include <vector>
#include <bitset>
#include <cassert>
using namespace std;
typedef bitset<500001> BS;
typedef vector<int> VI;
typedef vector<VI> VVI;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
const int N = w.size();
// assert(N <= 100 && u <= 1000);
BS can;
can[0] = true;
for (int n = 0; n < N; ++n) {
// cerr << "* n:" << n << " w:" << w[n] << endl;
// cerr << can[n] << endl;
// cerr << (can[n] << w[n]) << endl;
can |= can << w[n];
}
for (int sum = l; sum <= u; ++sum) {
if (can[sum]) {
vector<int> res;
for (int s = sum, n = N-1; s != 0; --n) {
assert(n >= 0);
if (s - w[n] >= 0 && can[s - w[n]]) {
res.push_back(n);
s -= w[n];
}
}
return res;
}
}
return {};
}
# | 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... |