#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef tuple <ll,ll,ll> plll;
typedef vector <plll> vplll;
typedef pair <ll,ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef vector <vector <pll>> vvpll;
typedef vector <vector <ll>> vvll;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;
std::vector<int> find_subset(int l, int r, std::vector<int> w) {
ll n = w.size();
ll maxi =r+2;
vector<pair<ll, vll>> dp(maxi,{0,{}} );
loop(i,0,maxi) dp[i].second.resize(n,0);
dp[0].first = 1;
loop(i,1,maxi) {
loop(j,0,n) {
ll num = w[j];
if (i-num>=0 && dp[i-num].first == 1 && dp[i-num].second[j]==0) {
dp[i].first = 1;
dp[i].second = dp[i-num].second;
dp[i].second[j] = 1;
}
}
}
loop(x,l,r+1) {
if (dp[x].first == 1) {
vector<int> ansi;
loop(i,0,n) if (dp[x].second[i]== 1) ansi.push_back(i);
return ansi;
}
}
return {};
}
Compilation message (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... |