Submission #434579

# Submission time Handle Problem Language Result Execution time Memory
434579 2021-06-21T12:24:21 Z Blagojce Jelly Flavours (IOI20_jelly) C++17
0 / 100
113 ms 163004 KB
#include <bits/stdc++.h>

#include "jelly.h"
//#include "grader.cpp"

#include <vector>

using namespace std;


int N;

vector<int> A;
vector<int> B;

int memo[502][202][202];

int dp(int pos, int remx, int remy){
	if(pos == 0) return 0;
	
	if(memo[pos][remx][remy] != -1) return memo[pos][remx][remy];
	
	int ret = dp(pos-1, remx, remy);
	if(remx >= A[pos-1]){
		ret = max(ret, dp(pos-1, remx-A[pos-1], remy) + 1);
	}
	if(remy >= B[pos-1]){
		ret = max(ret, dp(pos-1, remx, remy-B[pos-1]) + 1);
	}
	memo[pos][remx][remy] = ret;
	
	return ret;
}

int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
	memset(memo, -1, sizeof(memo));
	N = a.size();
	A = a;
	B = b;
	return dp(N, x, y);
}
# Verdict Execution time Memory Grader output
1 Correct 37 ms 80324 KB Output is correct
2 Correct 35 ms 80412 KB Output is correct
3 Correct 35 ms 80460 KB Output is correct
4 Correct 39 ms 80396 KB Output is correct
5 Correct 35 ms 80460 KB Output is correct
6 Correct 33 ms 80352 KB Output is correct
7 Correct 36 ms 80392 KB Output is correct
8 Correct 34 ms 80460 KB Output is correct
9 Correct 35 ms 80468 KB Output is correct
10 Incorrect 37 ms 80360 KB 1st lines differ - on the 1st token, expected: '12', found: '13'
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 80324 KB Output is correct
2 Correct 35 ms 80412 KB Output is correct
3 Correct 35 ms 80460 KB Output is correct
4 Correct 39 ms 80396 KB Output is correct
5 Correct 35 ms 80460 KB Output is correct
6 Correct 33 ms 80352 KB Output is correct
7 Correct 36 ms 80392 KB Output is correct
8 Correct 34 ms 80460 KB Output is correct
9 Correct 35 ms 80468 KB Output is correct
10 Incorrect 37 ms 80360 KB 1st lines differ - on the 1st token, expected: '12', found: '13'
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 113 ms 163004 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 109 ms 162996 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 108 ms 162928 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 80324 KB Output is correct
2 Correct 35 ms 80412 KB Output is correct
3 Correct 35 ms 80460 KB Output is correct
4 Correct 39 ms 80396 KB Output is correct
5 Correct 35 ms 80460 KB Output is correct
6 Correct 33 ms 80352 KB Output is correct
7 Correct 36 ms 80392 KB Output is correct
8 Correct 34 ms 80460 KB Output is correct
9 Correct 35 ms 80468 KB Output is correct
10 Incorrect 37 ms 80360 KB 1st lines differ - on the 1st token, expected: '12', found: '13'
11 Halted 0 ms 0 KB -