# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
394531 | idk321 | Detecting Molecules (IOI16_molecules) | C++11 | 164 ms | 532 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 10005;
int dp[M];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int> res;
for (int i = 0; i < M; i++)
{
dp[i] = -1;
}
dp[0] = 0;
for (int i = 0; i < w.size(); i++)
{
for (int j = M - 1 - w[i]; j >= 0; j--)
{
if (dp[j] != -1 && dp[j + w[i]] == -1)
{
dp[j + w[i]] = i;
}
}
}
for (int i = l; i <= u; i++)
{
if (dp[i] != -1)
{
int cur = i;
while (cur != 0)
{
res.push_back(dp[cur]);
cur -= w[dp[cur]];
}
break;
}
}
return res;
}
/*
7
15 16
5 5 5 5 6 6 6
*/
Compilation message (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... |