Submission #302322

# Submission time Handle Problem Language Result Execution time Memory
302322 2020-09-18T15:38:16 Z chirathnirodha Jelly Flavours (IOI20_jelly) C++17
0 / 100
1443 ms 24504 KB
#include "jelly.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;

vector<int> aprice;
vector<int> bprice;
int dp[501][501][12];
int knapsack(int x,int y,int ind){
    if(dp[x][y][ind]!=-1)return dp[x][y][ind];
  	if(ind==-1 || (x==0 && y==0))dp[x][y][ind]=0;
    else if(x-aprice[ind]>=0 && y-bprice[ind])dp[x][y][ind]=max(max(knapsack(x-aprice[ind],y,ind-1),knapsack(x,y-bprice[ind],ind-1))+1,knapsack(x,y,ind-1));
    else if(x-aprice[ind]>=0)dp[x][y][ind]=max(knapsack(x-aprice[ind],y,ind-1)+1,knapsack(x,y,ind-1));
    else if(y-bprice[ind]>=0)dp[x][y][ind]=max(knapsack(x,y-bprice[ind],ind-1)+1,knapsack(x,y,ind-1));
    else dp[x][y][ind]=knapsack(x,y,ind-1);
    return dp[x][y][ind];
}
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
	int n = a.size();
  	for(int i=0;i<=x;i++)for(int j=0;j<=y;j++)for(int k=0;k<n;k++)dp[i][j][k]=-1;
	aprice=a;
	bprice=b;
	return knapsack(x,y,n-1);
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4096 KB Output is correct
2 Incorrect 7 ms 9728 KB 1st lines differ - on the 1st token, expected: '7', found: '9'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4096 KB Output is correct
2 Incorrect 7 ms 9728 KB 1st lines differ - on the 1st token, expected: '7', found: '9'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 12288 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1443 ms 24396 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1145 ms 24504 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4096 KB Output is correct
2 Incorrect 7 ms 9728 KB 1st lines differ - on the 1st token, expected: '7', found: '9'
3 Halted 0 ms 0 KB -