Submission #1054459

# Submission time Handle Problem Language Result Execution time Memory
1054459 2024-08-12T10:02:24 Z Ahmed57 Soccer Stadium (IOI23_soccer) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"

using namespace std;
#define int long long
map<int,int> dp[501][501][501];
int n;
vector<pair<int,int>> rngs[31];
int solve(int l,int r,int x,int y){
    if(l==0&&r==n-1)return 0;
    if(dp[l][r][x].find(y)!=dp[l][r][x].end())return dp[l][r][x][y];
    int ma = 0;
    if(l){
        for(auto j:rngs[l-1]){
            if(max(x,j.first)<=min(y,j.second)){
                ma = max(ma,solve(l-1,r,max(x,j.first),min(y,j.second))+(min(y,j.second)-max(x,j.first)+1));
            }
        } 
    }if(r<n-1){
        for(auto j:rngs[r+1]){
            if(max(x,j.first)<=min(y,j.second)){
                ma = max(ma,solve(l,r+1,max(x,j.first),min(y,j.second))+(min(y,j.second)-max(x,j.first)+1));
            }
        }
    }
    return dp[l][r][x][y] = ma;
}
int biggest_stadium(int N, vector<vector<int>> v){
    memset(dp,-1,sizeof dp);
    n = N;
    for(int i = 0;i<N;i++){
        int la = 0;
        for(int j = 0;j<N;j++){
            if(v[i][j]==0){
                if(la==-1)la = j;
            }else{
                if(la<j&&la!=-1)rngs[i].push_back({la,j-1});
                la = -1;
            }
        }
        if(la!=-1)rngs[i].push_back({la,N-1});
    }
    int all = 0;
    for(int i = 0;i<N;i++){
        for(auto j:rngs[i]){
            all= max(all,solve(i,i,j.first,j.second)+(j.second-j.first+1));
        }
    }
    return all;
}

Compilation message

/usr/bin/ld: /tmp/ccuHZUoC.o: in function `main':
grader.cpp:(.text.startup+0x4ac): undefined reference to `biggest_stadium(int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
/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