제출 #530698

#제출 시각아이디문제언어결과실행 시간메모리
530698CyanmondDetecting Molecules (IOI16_molecules)C++17
31 / 100
28 ms65540 KiB
// #include "molesules.h" #include <bits/stdc++.h> template <typename T> using Vec = std::vector<T>; std::vector<int> find_subset(int L, int R, std::vector<int> W) { const int N = (int)W.size(); Vec<Vec<int>> dp(N + 1, std::vector<int>(R + 1, -1)); dp[0][0] = 0; for (int i = 0; i < N; ++i) { for (int j = 0; j <= R; ++j) { if (dp[i][j] == -1) continue; dp[i + 1][j] = dp[i][j]; if (j + W[i] <= R) dp[i + 1][j + W[i]] = i; } } for (int answer_w = L; answer_w <= R; ++answer_w) { if (dp[N][answer_w] == -1) continue; Vec<int> answer; int now = answer_w, now_id = N; while (now != 0) { const int new_id = dp[now_id][now]; answer.push_back(new_id); now -= W[new_id]; now_id = new_id; } return answer; } return {}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...