Submission #406450

# Submission time Handle Problem Language Result Execution time Memory
406450 2021-05-17T15:33:36 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 maxi(int x, int y, std::vector<int> a, std::vector<int> b,int nodo,int r){
	if(nodo=a.size()){
		return r;
	}
	else{
		if(a[nodo]<=x && b[nodo]<=y){
			return max(maxi(x-a[nodo],y,a,b,nodo+1,r+1),maxi(x,y-b[nodo],a,b,nodo+1,r+1),maxi(x,y,a,b,nodo+1,r));
		}
		else if(a[nodo]<=x){
			return max(maxi(x-a[nodo],y,a,b,nodo+1,r+1),maxi(x,y,a,b,nodo+1,r));
		}
		else if(b[nodo]<=y){
			return max(maxi(x,y-b[nodo],a,b,nodo+1,r+1),maxi(x,y,a,b,nodo+1,r));
		}
		else{
			return r;
		}
	}
}
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
	int n = a.size();
	return maxi(x,y,a,b,0,0);
}

Compilation message

jelly.cpp: In function 'int maxi(int, int, std::vector<int>, std::vector<int>, int, int)':
jelly.cpp:16:9: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   16 |  if(nodo=a.size()){
      |     ~~~~^~~~~~~~~
jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:35:6: warning: unused variable 'n' [-Wunused-variable]
   35 |  int n = a.size();
      |      ^
In file included from /usr/include/c++/10/vector:60,
                 from jelly.h:1,
                 from jelly.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
jelly.cpp:21:103:   required from here
/usr/include/c++/10/bits/stl_algobase.h:303:17: error: '__comp' cannot be used as a function
  303 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~