#include "molecules.h"
#include <cstdint>
#include <random>
#include <bitset>
#include <vector>
#include <iostream>
#include <cassert>
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 998244353;
const ll INF = 1e18;
const ld EPS = 1e-12;
#define endl "\n"
#define sp <<" "<<
#define REP(i, a, b) for(ll i = a; i < b; i++)
#define dbg(x) cout << #x << " = " << x << endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
const int MAXN = 5e5+5;
vector<int> find_subset(int l, int r, vector<int> w) {
assert(l <= 5e5 and r <= 5e5);
int x = -1;
int n = w.size();
vector<int> kp(r+1, 0), pr(r+1, -1);
kp[0] = 1;
REP(i, 0, n) {
for (int j = r - w[i]; j >= 0; j--) {
if (kp[j] and !kp[j + w[i]]) {
kp[j + w[i]] = true;
pr[j + w[i]] = i;
if (l <= j + w[i] and j + w[i] <= r) {
x = j + w[i];
break;
}
}
}
}
// for (int i = l; i <= r; i++) {
// if (kp[i]) {
// x = i;
// break;
// }
// }
vector<int> ans;
if (x == -1) {
return ans;
}
while (x and pr[x] != -1) {
ans.push_back(pr[x]);
x -= w[pr[x]];
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
molecules.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# | 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... |