# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
262183 | stoyan_malinin | Detecting Molecules (IOI16_molecules) | C++14 | 164 ms | 640 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 "grader.cpp"
#include <bitset>
#include <cstring>
using namespace std;
const int MAXN = 1e4 + 5;
int dp[MAXN];
vector<int> find_subset(int l, int u, vector <int> w)
{
memset(dp, -1, sizeof(dp));
dp[0] = -2;
for(int i = 0;i<w.size();i++)
{
for(int j = u-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)
{
vector <int> answer;
int x = i;
while(x!=0)
{
answer.push_back(dp[x]);
x = x - w[ dp[x] ];
}
return answer;
}
}
return vector <int> {};
}
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... |