# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
789225 | LIF | Jelly Flavours (IOI20_jelly) | C++14 | 6 ms | 1236 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 "jelly.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
int pricea[300005];
int priceb[300005];
int dp[505][505];
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
for(int i=0;i<a.size();i++)pricea[i+1] = a[i];
for(int i=0;i<b.size();i++)priceb[i+1] = b[i];
dp[0][0] = 0;
int n = a.size();
for(int i=1;i<=n;i++)
{
for(int j=x;j>=1;j--)
{
for(int k=y;k>=1;k--)
{
if(j >= pricea[i])dp[j][k] = max(dp[j-pricea[i]][k] + 1, dp[j][k]);
if(k >= priceb[i])dp[j][k] = max(dp[j][k-priceb[i]]+1,dp[j][k]);
}
}
}
int maxx = -1;
for(int j=1;j<=x;j++)
{
for(int k=1;k<=y;k++)
{
maxx = max(maxx,dp[j][k]);
}
}
return maxx;
}
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... |