이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
#define rall(s) s.rbegin(), s.rend()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define s second
#define f first
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
vector<int> find_subset(int l, int r, vector<int> w) {
int dp[r + 1], n = sz(w);
memset(dp, 0, sizeof(dp));
dp[0] = -1;
for (int i = 1; i <= n; i++) {
int x = w[i - 1];
for (int j = r; j >= x; j--) {
if (dp[j - x] && !dp[j]) dp[j] = i;
}
}
for (int i = l; i <= r; i++) {
if (dp[i]) {
vector<int> res;
while (i) {
res.push_back(dp[i]);
i -= w[dp[i] - 1];
}
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... |