Submission #993516

# Submission time Handle Problem Language Result Execution time Memory
993516 2024-06-05T22:54:10 Z Clan328 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 mp make_pair
#define nL '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;

void eval(bool condition) { cout << (condition ? "yes" : "no") << nL; }
void Eval(bool condition) { cout << (condition ? "Yes" : "No") << nL; }
void EVAL(bool condition) { cout << (condition ? "YES" : "NO") << nL; }

int ipow(int a, int n) {
   if (n == 0) return 1;
   int x = ipow(a, n/2);
   if (n % 2 == 0) return x*x;
   return x*x*a;
}

template <typename T>
ostream& operator<<(ostream& stream, const vector<T>& v) {
    for (auto elem : v) 
        stream << elem << " ";
    return stream;
}

template <typename T>
istream& operator>>(istream& stream, vector<T>& v){
   for(auto &elem : v)
        stream >> elem;
   return stream;
}

long long max_weights(int N, int M, vi X, vi Y,
                      vi W) {
    ll maxY = 0;
    for (int i = 0; i < M; i++) maxY = max(maxY, (ll)Y[i]);

    vvl mat(N, vl(maxY+1));
    for (int i = 0; i < M; i++) mat[X[i]][Y[i]] = W[i];

    vector<vvl> dp(N, vvl(maxY+1, vl(maxY+1)));
    for (int i = 1; i < N; i++) {
        int tmp1 = 0;
        for (int j = 0; j <= maxY; j++) {
            tmp1 += mat[i-1][j];
            int tmp2 = 0;
            for (int k = 0; k <= maxY; k++) {
                if (k <= j) {
                    tmp2 -= mat[i-1][k];
                } else {
                    tmp2 += mat[i][k];
                }

                int tmp3 = 0;
                for (int l = 0; l <= maxY;l++) {
                    if (l > k && l <= j) tmp3 -= mat[i-1][l];

                    dp[i][j][k] = max(dp[i][j][k], dp[i-1][k][l]+tmp1+tmp2+tmp3);
                }
            }
        }
    }

    long long res = 0;
    for (int i = 0; i <= maxY; i++) {
        for (int j = 0; j <= maxY; j++)
            res = max(res, dp[N-1][i][j]);
    }

    return res;
}














Compilation message

<command-line>: error: expected unqualified-id before numeric constant
fish.cpp:26:6: note: in expansion of macro 'EVAL'
   26 | void EVAL(bool condition) { cout << (condition ? "YES" : "NO") << nL; }
      |      ^~~~