# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1197268 | andrejikus | Detecting Molecules (IOI16_molecules) | C++20 | 90 ms | 584 KiB |
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
typedef long long ll;
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
const int N = 1e4 + 3;
const int inf = 1e9;
int dp[N];
vector<int> find_subset(int l, int u, vector<int> w) {
for (int i = 0; i < N; i++) dp[i] = inf;
vector<int> res;
dp[0] = 0;
for (int i = 0; i < w.size(); i++) {
for (int j = 0; j <= u; j++) {
if (j-w[i] < 0) continue;
if (dp[j-w[i]] == inf || dp[j-w[i]] == i+1) continue;
dp[j] = min(dp[j], i+1);
}
}
for (int t = l; t <= u; t++) {
if (dp[t] == inf) continue;
int j = t;
while (j != 0) {
res.push_back(dp[j]-1);
j -= w[dp[j]-1];
}
if (j == 0) break;
}
sort(res.begin(), res.end());
return res;
}
컴파일 시 표준 에러 (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... |