# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1270161 | almaz | Detecting Molecules (IOI16_molecules) | C++20 | 55 ms | 624 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
// #define int long long
// #define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define all(a) a.begin(), a.end()
// const int MOD = 1e9 + 7,INF = 1e18;
std::vector<int> find_subset(int l1, int u, std::vector<int> w) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n = w.size(), l = l1 , r = u;
if(l == 1 && r == 1){
while(true);
}
vector <int> a(n);
int sum = 0;
for(int i = 0;i < n;i++){
a[i] = w[i];
sum += a[i];
}
bitset<200000> dp;
dp[0] = 1;
for(int i = 0;i < n;i++){
bitset<200000> f = dp << a[i];
bitset<200000> ndp = dp | f;
dp = ndp;
}
int ans = -1;
vector <int> b;
for(int i = l;i <= r;i++){
if(dp[i] == 1){
ans = i;
break;
}
}
if(ans == -1){
return b;
}
for(int i = 0;i < n;i++){
if(ans - a[i] >= 0 && dp[ans - a[i]] == 1){
ans -= a[i];
b.pb(i);
}
}
return b;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |