Submission #1018592

# Submission time Handle Problem Language Result Execution time Memory
1018592 2024-07-10T07:16:28 Z tinjyu Soccer Stadium (IOI23_soccer) C++17
Compilation error
0 ms 0 KB
#include "soccer.h"
#include <iostream>
long long int dp[505][505][505];
long long int dp_left[505][505][505], dp_right[505][105][505];
long long int left_bound[505][505], right_bound[505][505];

using namespace std;

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{

    long long int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int lf = -1;
        for (int j = 0; j < N; j++)
        {
            if (F[i][j] == 1)
            {
                lf = j;
            }
            left_bound[i][j] = lf;
        }
        int rf = N;
        for (int j = N - 1; j >= 0; j--)
        {
            if (F[i][j] == 1)
            {
                rf = j;
            }
            right_bound[i][j] = rf;
        }
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (F[i][j] == 1)
            {
                dp[i][i][j] = -1;
            }
            else
            {
                dp[i][i][j] = right_bound[i][j] - left_bound[i][j] - 1;
                dp_left[i][i][j] = left_bound[i][j];
                dp_right[i][i][j] = right_bound[i][j];
            }
            ans = max(ans, dp[i][i][j]);
        }
    }

    for (int len = 2; len <= N; len++)
    {
        for (int i = 0; i + len - 1 < N; i++)
        {
            for (int col = 0; col < N; col++)
            {

                int up = i, down = i + len - 1;
                // cout << dp[up][down][col] << " " << up << " " << down << " " << col << endl;

                if (F[up][col] == 0)
                {
                    int lf = max(dp_left[up + 1][down][col], left_bound[up][col]);
                    int ri = min(dp_right[up + 1][down][col], right_bound[up][col]);
                    dp[up][down][col] = dp[up + 1][down][col] + ri - lf - 1;
                    dp_left[up][down][col] = lf;
                    dp_right[up][down][col] = ri;
                }
                if (F[down][col] == 0)
                {
                    int lf = max(dp_left[up][down - 1][col], left_bound[down][col]);
                    int ri = min(dp_right[up][down - 1][col], right_bound[down][col]);
                    if (dp[up][down - 1][col] + ri - lf - 1 > dp[up][down][col])
                    {

                        dp[up][down][col] = max(dp[up][down - 1][col] + ri - lf - 1, dp[up][down][col]);
                        dp_left[up][down][col] = lf;
                        dp_right[up][down][col] = ri;
                    }
                }
                // cout << dp[up][down][col] << " " << up << " " << down << " " << col << endl;
                ans = max(ans, dp[up][down][col]);
            }
        }
    }
    return ans;
}

Compilation message

/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status