Submission #858722

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

#include <bits/stdc++.h>

using namespace std;

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

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

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

    for (long long i = 1; i <= N; i++) {
        for (long long j = 1; j <= N; j++) sumtop[i][j] += sumtop[i][j-1];
        for (long long j = N; j >= 1; j--) sumbot[i][j] += sumbot[i][j-1];
    }
  
    for (long long i = 1; i <= N; i++) {
        for (long long j = 0; j <= N; j++) {
            for (long long 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)
                );
            }
        }
    }

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

    return mx;

}

Compilation message

/usr/bin/ld: /tmp/cc1LH8uA.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