Submission #858720

# Submission time Handle Problem Language Result Execution time Memory
858720 2023-10-09T05:34:55 Z deepaung Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include "fish.h"

#include <bits/stdc++.h>

#define ll long long

using namespace std;

ll sumtop[3003][3003], sumbot[3003][3003];
ll dp[3003][3003];

long long max_weights(ll N, ll M, vector<ll> X, vector<ll> Y, vector<ll> W) {

    for (ll i = 0; i < M; i++) {
        sumtop[X[i]+1][Y[i]+1] += W[i];
        sumbot[X[i]+1][Y[i]+1] += W[i];
    }

    for (ll i = 1; i <= N; i++) {
        for (ll j = 1; j <= N; j++) sumtop[i][j] += sumtop[i][j-1];
        for (ll j = N; j >= 1; j--) sumbot[i][j] += sumbot[i][j-1];
    }
  
    for (ll i = 1; i <= N; i++) {
        for (ll j = 0; j <= N; j++) {
            for (ll k = 0; k <= N; k++) {
                dp[i][j] = max(
                    dp[i][j], 
                    dp[i-1][k] - sumbot[i][min(j, k)] + sumbot[i+1][k] + (k > j ? sumbot[i-1][k] - sumbot[i-1][j] : 0)
                );
            }
        }
    }

    ll mx = 0;
    for (ll j = 1; j <= N; j++) {
        mx = max(mx, dp[N][j]);
    }

    return mx;

}

Compilation message

/usr/bin/ld: /tmp/ccr6YRfg.o: in function `main':
grader.cpp:(.text.startup+0x25e): undefined reference to `max_weights(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status