Submission #673018

# Submission time Handle Problem Language Result Execution time Memory
673018 2022-12-19T12:05:58 Z Hacv16 Jelly Flavours (IOI20_jelly) C++17
0 / 100
917 ms 2097152 KB
#include <bits/stdc++.h>
#include "jelly.h"
using namespace std;

const int MAX = 2015;
int n, a[MAX], b[MAX];

int find_maximum_unique(int x, int y, vector<int> _a, vector<int> _b) {
	n = _a.size();
	
	for(int i = 1; i <= n; i++){
		a[i] = _a[i - 1];
		b[i] = _b[i - 1];
	}

	assert(y != 0);

	if(y == 0){
		sort(a + 1, a + 1 + n);

		int resp = 0, i = 1;

		while(x - a[i] >= 0){
			x -= a[i];
			resp++; i++;
		}

		return resp;
	}

	vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(x + 1, vector<int>(y + 1, 0)));

	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= x; j++){
			for(int k = 0; k <= y; k++){
				int cur = dp[i - 1][j][k];

				if(j >= a[i]) cur = max(cur, dp[i - 1][j - a[i]][k] + 1);
				if(k >= b[i]) cur = max(cur, dp[i - 1][j][k - b[i]] + 1);

				dp[i][j][k] = cur;
			}
		}
	}

	return dp[n][x][y];
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2132 KB Output is correct
2 Correct 8 ms 8548 KB Output is correct
3 Correct 7 ms 8916 KB Output is correct
4 Correct 11 ms 11988 KB Output is correct
5 Correct 11 ms 9520 KB Output is correct
6 Correct 6 ms 7764 KB Output is correct
7 Correct 9 ms 10540 KB Output is correct
8 Correct 7 ms 7728 KB Output is correct
9 Correct 9 ms 9812 KB Output is correct
10 Correct 14 ms 11732 KB Output is correct
11 Correct 2 ms 1364 KB Output is correct
12 Correct 3 ms 2132 KB Output is correct
13 Correct 7 ms 8532 KB Output is correct
14 Correct 8 ms 8916 KB Output is correct
15 Correct 12 ms 12096 KB Output is correct
16 Correct 9 ms 9556 KB Output is correct
17 Correct 7 ms 7860 KB Output is correct
18 Correct 10 ms 10672 KB Output is correct
19 Correct 7 ms 7636 KB Output is correct
20 Correct 9 ms 9812 KB Output is correct
21 Correct 2 ms 2132 KB Output is correct
22 Correct 13 ms 11732 KB Output is correct
23 Correct 2 ms 2132 KB Output is correct
24 Runtime error 1 ms 468 KB Execution killed with signal 6
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2132 KB Output is correct
2 Correct 8 ms 8548 KB Output is correct
3 Correct 7 ms 8916 KB Output is correct
4 Correct 11 ms 11988 KB Output is correct
5 Correct 11 ms 9520 KB Output is correct
6 Correct 6 ms 7764 KB Output is correct
7 Correct 9 ms 10540 KB Output is correct
8 Correct 7 ms 7728 KB Output is correct
9 Correct 9 ms 9812 KB Output is correct
10 Correct 14 ms 11732 KB Output is correct
11 Correct 2 ms 1364 KB Output is correct
12 Correct 3 ms 2132 KB Output is correct
13 Correct 7 ms 8532 KB Output is correct
14 Correct 8 ms 8916 KB Output is correct
15 Correct 12 ms 12096 KB Output is correct
16 Correct 9 ms 9556 KB Output is correct
17 Correct 7 ms 7860 KB Output is correct
18 Correct 10 ms 10672 KB Output is correct
19 Correct 7 ms 7636 KB Output is correct
20 Correct 9 ms 9812 KB Output is correct
21 Correct 2 ms 2132 KB Output is correct
22 Correct 13 ms 11732 KB Output is correct
23 Correct 2 ms 2132 KB Output is correct
24 Runtime error 1 ms 468 KB Execution killed with signal 6
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 838 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 917 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2132 KB Output is correct
2 Correct 8 ms 8548 KB Output is correct
3 Correct 7 ms 8916 KB Output is correct
4 Correct 11 ms 11988 KB Output is correct
5 Correct 11 ms 9520 KB Output is correct
6 Correct 6 ms 7764 KB Output is correct
7 Correct 9 ms 10540 KB Output is correct
8 Correct 7 ms 7728 KB Output is correct
9 Correct 9 ms 9812 KB Output is correct
10 Correct 14 ms 11732 KB Output is correct
11 Correct 2 ms 1364 KB Output is correct
12 Correct 3 ms 2132 KB Output is correct
13 Correct 7 ms 8532 KB Output is correct
14 Correct 8 ms 8916 KB Output is correct
15 Correct 12 ms 12096 KB Output is correct
16 Correct 9 ms 9556 KB Output is correct
17 Correct 7 ms 7860 KB Output is correct
18 Correct 10 ms 10672 KB Output is correct
19 Correct 7 ms 7636 KB Output is correct
20 Correct 9 ms 9812 KB Output is correct
21 Correct 2 ms 2132 KB Output is correct
22 Correct 13 ms 11732 KB Output is correct
23 Correct 2 ms 2132 KB Output is correct
24 Runtime error 1 ms 468 KB Execution killed with signal 6
25 Halted 0 ms 0 KB -