이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> pii;
#include "molecules.h"
constexpr int maxu = 1e4 + 5;
int last[maxu] = { 0 };
bool found[maxu] = { 0 };
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
found[0] = true;
int highest = 0;
int p;
for (int v = 0; v < (int)w.size(); v++)
{
for (int i = min(highest, maxu - 2); i >= 0; i--)
{
if (!found[i]) continue;
// cout << i << endl;
if (i + w[v] >= maxu) continue;
if (found[i + w[v]]) continue;
found[i + w[v]] = true;
last[i + w[v]] = v;
if (l <= i + w[v] && i + w[v] <= u) {
p = i + w[v];
goto finish;
}
}
highest += w[v];
}
return vector<int>{};
finish:
vector <int> output;
// int i = 15;
while (p != 0)
{
output.emplace_back(last[p]);
// cout << "p" << p << endl;
p -= w[last[p]];
}
return output;
}
# | 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... |