| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1319216 | yessimkhan | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 0 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
// solved by bekagg
#define ll long long
#define ent '\n'
#define pb push_back
#define all(x) x.begin(),x.end()
#define PRaim_bek_abi ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
const int N = 1e5+5;
const int MOD = 1e9+7;
int p[N];
vector<int> find_subset(int l, int u, vector<int> w){
p[0] = -1;
for (int i = 0; i < w.size(); i++){
for (int j = u; j >= w[i]; j--){
if (p[j] != 0 or p[j - w[i]] == 0){
continue;
}
p[j] = i;
}
}
for (int i = l; i <= u; i++){
if (p[i] != 0){
vector<int>ans;
int x = j;
while(x){
ans.pb(p[x]);
x -= w[p[x]];
}
return ans;
}
}
return {0};
}
