Submission #406557

# Submission time Handle Problem Language Result Execution time Memory
406557 2021-05-17T17:41:53 Z victoriad Jelly Flavours (IOI20_jelly) C++14
Compilation error
0 ms 0 KB
#include "jelly.h"
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <stack>
#include <fstream>
using namespace std;
int ma,mb;
vector<vector<vector<int> > >dp;
int maxi(int x, int y, std::vector<int> a, std::vector<int> b,int nodo){
	if(nodo=a.size()||(x==0 && y==0))return 0;
	int &ans=dp[nodo][x][y];
	if(ans !=-1)return ans;
	if(a[nodo]<=x && b[nodo]<=y){
		return ans=max(maxi(x,y,a,b,nodo+1),max(maxi(x-a[nodo],y,a,b,nodo+1)+1,maxi(x,y-b[nodo],a,b,nodo+1)+1));
	}
	else if(a[nodo]<=x){
		return ans=max(maxi(x,y,a,b,nodo+1),maxi(x-a[nodo],y,a,b,nodo+1)+1);
	}
	else if(b[nodo]<=y){
		return ans=max(maxi(x,y,a,b,nodo+1),maxi(x,y-b[nodo],a,b,nodo+1)+1);
	}
	else{
		ans=maxi(x,y,a,b,nodo+1);
	}
}
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
	int n = a.size();
	vector<int>a(y,0);
	vector<vector<int> > g;
	for(int i=0;i<x;i++)g.push_back(a);
	for(int i=0;i<n;i++)dp.push_back(g);
	return maxi(x,y,a,b,0);
}

Compilation message

jelly.cpp: In function 'int maxi(int, int, std::vector<int>, std::vector<int>, int)':
jelly.cpp:17:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   17 |  if(nodo=a.size()||(x==0 && y==0))return 0;
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:35:13: error: declaration of 'std::vector<int> a' shadows a parameter
   35 |  vector<int>a(y,0);
      |             ^
jelly.cpp:33:56: note: 'std::vector<int> a' previously declared here
   33 | int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
      |                                       ~~~~~~~~~~~~~~~~~^
jelly.cpp: In function 'int maxi(int, int, std::vector<int>, std::vector<int>, int)':
jelly.cpp:30:6: warning: control reaches end of non-void function [-Wreturn-type]
   30 |   ans=maxi(x,y,a,b,nodo+1);
      |   ~~~^~~~~~~~~~~~~~~~~~~~~