Submission #673012

# Submission time Handle Problem Language Result Execution time Memory
673012 2022-12-19T11:53:46 Z Hacv16 Jelly Flavours (IOI20_jelly) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "jelly.h"
using namespace std;

const int MAX = 510;
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];
	}

	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];
}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:9:8: error: request for member 'size' in 'a', which is of non-class type 'int [510]'
    9 |  n = a.size();
      |        ^~~~
jelly.cpp:21:29: error: no match for call to '(std::vector<std::vector<std::vector<int> > >) (int, int&, int&)'
   21 |     int cur = dp(i - 1, j, k);
      |                             ^
jelly.cpp:23:55: error: no match for call to '(std::vector<std::vector<std::vector<int> > >) (int, int, int&)'
   23 |     if(j >= a[i]) cur = max(cur, dp(i - 1, j - a[i], k) + 1);
      |                                                       ^
jelly.cpp:24:55: error: no match for call to '(std::vector<std::vector<std::vector<int> > >) (int, int&, int)'
   24 |     if(k >= b[i]) cur = max(cur, dp(i - 1, j, k - b[i]) + 1);
      |                                                       ^