Submission #745736

# Submission time Handle Problem Language Result Execution time Memory
745736 2023-05-21T06:02:27 Z inventiontime Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include "fish.h"

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define re resize
#define ff first
#define ss second

#define all(x) (x).begin(), (x).end()
#define all1(x) (x).begin()+1, (x).end()
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, n) for(int i = 1; i <= n; i++)

#define print(x) cout << #x << ": " << x << endl << flush

template<class T> bool ckmin(T&a, T b) { bool B = a > b; a = min(a, b); return B; }
template<class T> bool ckmax(T&a, T b) { bool B = a < b; a = max(a, b); return B; }

typedef long long ll;
typedef vector<int> vi;

ll max_weights(int n, int m, vi x, vi y, vi w) {

    ll fish[n+1];
    loop(i, n+1) fish[i] = 0;
    loop(i, m)
        fish[x[i]+1] = w[i];
    
    ll dp[n+1][2][2];
    dp[0][0][0] = 0;
    dp[0][0][1] = 0;
    dp[0][1][0] = 0;
    dp[0][1][1] = 0;

    loop1(i, n) {
        dp[i][0][0] = max(dp[i-1][0][0], dp[i-1][1][0]);
        dp[i][0][1] = max(dp[i-1][1][0], dp[i-1][0][0]) + fish[i];
        dp[i][1][0] = max(dp[i-1][0][1], dp[i-1][1][1]);
        dp[i][1][1] = dp[i-1][0][1] + fish[i];
    }
    
    return max(dp[n][0][0], dp[n][0][1], dp[n][1][0]);

}

Compilation message

In file included from /usr/include/c++/10/vector:60,
                 from fish.h:1,
                 from fish.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 = long long int; _Compare = long long int]':
fish.cpp:44:53:   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))
      |           ~~~~~~^~~~~~~~~~