| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360063 | skuru | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 344 KiB |
#include "molecules.h"
using namespace std;
#define all(v) (v).begin(), (v).end()
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<vector<bool>> dp(n, vector<bool>(u + 1));
dp[0][0] = dp[0][w[0]] = true;
for (int i = 1; i < n; i++) {
for (int j = 0; j <= u; j++) {
dp[i][j] = dp[i - 1][j];
int k = j - w[i];
if (k >= 0 and dp[i - 1][k])
dp[i][j] = true;
}
}
int j = l;
for (; j <= u; j++) {
if (dp[n - 1][j])
break;
}
if (not dp[n - 1][j])
return {};
vector<int> ret;
for (int i = n - 1; i != 0; i--) {
if (dp[i - 1][j])
continue;
j -= w[i];
ret.push_back(i);
}
if (j != 0)
ret.push_back(0);
return ret;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
