Submission #385532

#TimeUsernameProblemLanguageResultExecution timeMemory
385532The_BitchJelly Flavours (IOI20_jelly)C++14
Compilation error
0 ms0 KiB
//#define int long long #include "jelly.h" #define pb push_back #define F first #define S second using namespace std; const int N=1e6,M=1e4; int mem[203][600][600]; long long minn=1e18,mux=-1e18; int n,x,y; int a[N],b[N]; int dp(int i,int x,int y){ if(i==n)return 0; if(mem[i][x][y]!=-1)return mem[i][x][y]; if(x>=a[i]&&y>=b[i])return mem[i][x][y]=max({dp(i+1,x-a[i],y)+1,dp(i+1,x,y-b[i])+1,dp(i+1,x,y)}); else if(x>=a[i]&&y<b[i])return mem[i][x][y]=max(dp(i+1,x-a[i],y)+1,dp(i+1,x,y)); else if(x<a[i]&&y>=b[i])return mem[i][x][y]=max(dp(i+1,x,y-b[i])+1,dp(i+1,x,y)); else return mem[i][x][y]=dp(i+1,x,y); } int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) { n = a.size(); for(int i=0;i<n+2;i++) for(int j=0;j<x+2;j++) for(int k=0;k<y+2;k++) mem[i][j][k]=-1; return dp(0,x,y); }

Compilation message (stderr)

jelly.cpp: In function 'int dp(int, int, int)':
jelly.cpp:16:100: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   16 |     if(x>=a[i]&&y>=b[i])return mem[i][x][y]=max({dp(i+1,x-a[i],y)+1,dp(i+1,x,y-b[i])+1,dp(i+1,x,y)});
      |                                                                                                    ^
In file included from /usr/include/c++/9/vector:60,
                 from jelly.h:1,
                 from jelly.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:222:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  222 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:222:5: note:   template argument deduction/substitution failed:
jelly.cpp:16:100: note:   candidate expects 2 arguments, 1 provided
   16 |     if(x>=a[i]&&y>=b[i])return mem[i][x][y]=max({dp(i+1,x-a[i],y)+1,dp(i+1,x,y-b[i])+1,dp(i+1,x,y)});
      |                                                                                                    ^
In file included from /usr/include/c++/9/vector:60,
                 from jelly.h:1,
                 from jelly.cpp:2:
/usr/include/c++/9/bits/stl_algobase.h:268:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  268 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:268:5: note:   template argument deduction/substitution failed:
jelly.cpp:16:100: note:   candidate expects 3 arguments, 1 provided
   16 |     if(x>=a[i]&&y>=b[i])return mem[i][x][y]=max({dp(i+1,x-a[i],y)+1,dp(i+1,x,y-b[i])+1,dp(i+1,x,y)});
      |                                                                                                    ^