Submission #1125867

#TimeUsernameProblemLanguageResultExecution timeMemory
1125867ntdaccodeCatfish Farm (IOI22_fish)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define fori(i,a,b) for(int i=a;i<=b;i++) #define pb push_back using namespace std; typedef pair<int,int> ii; typedef tuple<int,int,int> tp; const int M = 1e6 + 10; const int N = 3e2 + 10; const int mod = 1e9 + 7; int n, m; long long D[N][N], f[2][N][N]; int64_t max_weights(int N, int M, vector<int> X , vector<int> Y , vector<int> W ) { n = N; m = M; for(int i = 0;i < m; i++) { X[i]++; Y[i]++; D[X[i]][Y[i]] = 1ll * W[i]; } memset(f,-61,sizeof(f)); for(int i = 1;i <= n; i++) f[0][1][i] = f[1][1][i] = 0; for(int i = 2;i <= n; i++) { // long long sum = 0; for(int j = 0;j <= n; j++) { sum += D[i][j]; f[0][i - 1][j] += sum; f[1][i - 1][j] += sum; } for(int j = 0;j <= n; j++) { for(int e = 0;e <= j; e++) f[0][i - 1][e] += D[i - 1][j]; for(int e = j;e <= n; e++) f[0][i - 1][e] -= D[i][j]; for(int e = 0;e <= n; e++) { if(e <= j) f[0][i][j] = max(f[0][i][j],f[0][i - 1][e]); else f[1][i][j] = max(f[1][i][j],f[0][i - 1][e]); } } for(int j = 0;j <= n; j++) { for(int e = j;e <= n; e++) f[1][i - 1][e] -= D[i][j]; for(int e = 0;e <= n; e++) { if(e <= j) f[0][i][j]= max(f[0][i][j], f[1][i - 1][e]); else f[1][i][j] = max(f[1][i][j], f[1][i - 1][e]); } } } int64_t kq = 0; for(int i = 0;i <= n; i++) kq = max({kq, f[0][n][i], f[1][n][i]}); return kq; }

Compilation message (stderr)

fish.cpp: In function 'int64_t max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:57:38: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   57 |   for(int i = 0;i <= n; i++) kq = max({kq, f[0][n][i], f[1][n][i]});
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from fish.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
fish.cpp:57:38: note:   candidate expects 2 arguments, 1 provided
   57 |   for(int i = 0;i <= n; i++) kq = max({kq, f[0][n][i], f[1][n][i]});
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from fish.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
fish.cpp:57:38: note:   candidate expects 3 arguments, 1 provided
   57 |   for(int i = 0;i <= n; i++) kq = max({kq, f[0][n][i], f[1][n][i]});
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from fish.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
fish.cpp:57:38: note:   deduced conflicting types for parameter '_Tp' ('long int' and 'long long int')
   57 |   for(int i = 0;i <= n; i++) kq = max({kq, f[0][n][i], f[1][n][i]});
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from fish.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
fish.cpp:57:38: note:   deduced conflicting types for parameter '_Tp' ('long int' and 'long long int')
   57 |   for(int i = 0;i <= n; i++) kq = max({kq, f[0][n][i], f[1][n][i]});
      |                                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~