답안 #915906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
915906 2024-01-24T21:38:03 Z biank 축구 경기장 (IOI23_soccer) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define SIZE(x) (int)x.size()
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define dforsn(i,s,n) for(int i=int(n)-1;i>=int(s);i--)
#define dforn(i,n) for(int i=int(n)-1;i>=0;i--)
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> ii;
const int MAXN = 2000;
int f[MAXN][MAXN];
pair<ll,ii> dp[MAXN][MAXN][MAXN];

int n;

int left(int i, int p) {
    dforn(j,p+1) if(f[i][j]==1) return j;
    return -1;
}
int right(int i, int p) {
    forsn(j,p,n) if(f[i][j]==1) return j;
    return n;
}

pair<ll,ii> solve(int l, int r, int p) {
    if(l>r) return {0LL,{-1,n}};
    if(dp[l][r][p].fst!=-1) return dp[l][r][p];
    auto calculate = [&](pair<int,ii> prev, int i) {
        auto [val,range] = prev;
        int mini = max(range.fst, left(i,p)), maxi = min(range.snd, right(i,p));
        return (pair<ll,ii>){val+max(maxi-mini-1,0),{mini,maxi}};
    };
    return dp[l][r][p] = max(calculate(solve(l+1,r,p),l),
                            calculate(solve(l,r-1,p),r));
}

int biggest_stadium(int N, vector<vector<int>> F) {
    n=N;
    forn(i,n) forn(j,n) {
        f[i][j]=F[i][j];
    }
    forn(i,n) forn(j,n) forn(k,n) {
        dp[i][j][k].fst = -1;
    }
    ll ans = 0LL;
    forn(i,n) {
        ll curr = solve(0,n-1,i).fst;
        ans=max(ans,curr);
    }
    return int(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