#include "jelly.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 510;
int dp[MAXN][MAXN][MAXN];
int calc(int i, int x, int y, int N, vector<int> &a, vector<int> &b)
{
if(x < 0 || y < 0) return -1;
if(dp[i][x][y] != 0) return dp[i][x][y];
if(i > N) return -1;
int op1 = calc(i + 1, x - a[i - 1], y, N, a, b) + 1;
int op2 = calc(i + 1, x, y - b[i - 1], N, a, b) + 1;
int op3 = calc(i + 1, x , y , N, a, b);
dp[i][x][y] = max(max(op1,op2),op3);
// cerr << dp[i][x][y] << " " << i << " " << x << " " << y << "\n";
return dp[i][x][y];
}
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
int N = a.size();
for(int i = 0; i <= N + 5; i++)
{
for(int j = 0; j <= N + 5; j ++)
{
for(int k = 0; k <= N + 5; k++)
dp[i][j][k] = 0;
}
}
return calc(1,x,y,N,a,b);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
14684 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
14684 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
880 ms |
1046660 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
669 ms |
1046648 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
661 ms |
1046868 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
14684 KB |
1st lines differ - on the 1st token, expected: '8', found: '7' |
2 |
Halted |
0 ms |
0 KB |
- |