QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294161#7120. Soccertraining4usacoCompile Error//C++172.4kb2023-12-30 08:52:272024-04-28 08:28:46

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 08:28:46]
  • 管理员手动重测本题所有提交记录
  • [2023-12-30 08:52:28]
  • 评测
  • [2023-12-30 08:52:27]
  • 提交

answer

#include <iostream>
#include <vector>
#include <stack>
using namespace std;

const int MAXN = 2e5 + 5;
const int INF = 1e9 + 7;

int ans = 0;
int grid[MAXN][MAXN];
int up[MAXN][MAXN], down[MAXN][MAXN];
int dp[MAXN][MAXN];
int prv[MAXN][MAXN], nxt[MAXN][MAXN];
int len[MAXN][MAXN];

void magic(int row, int u, int l, int r) {
    dp[row][u] = down[row][u] * (r - l + 1);
    len[row][u] = r - l + 1;

    if(prv[row][u] != -1) {
        magic(row, prv[row][u], l, u - 1);
        dp[row][u] = max(dp[row][u], dp[row][prv[row][u]] + (r - u + 1) * down[row][u]);
    }
    if(nxt[row][u] != -1) {
        magic(row, nxt[row][u], u + 1, r);
        dp[row][u] = max(dp[row][u], dp[row][nxt[row][u]] + (u - l + 1) * down[row][u]);
    }

    if(dp[row - 1][u] != -INF) dp[row][u] = max(dp[row][u], dp[row - 1][u] + (len[row][u] - len[row - 1][u]) * down[row][u]);

    ans = max(ans, dp[row][u]);
}

int biggest_stadium(int n, vector<vector<int>> f) {
    for(int i = 0; i <= n + 1; ++i) for(int j = 0; j <= n + 1; ++j) grid[i][j] = 0;
    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= n; ++j) grid[i][j] = f[i][j];
    }

    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= n; ++j) {
            if(grid[i][j]) up[i][j] = 0;
            else up[i][j] = up[i - 1][j] + 1;
        }
    }

    for(int i = n; i >= 1; --i) {
        for(int j = 1; j <= n; ++j) {
            if(grid[i][j]) down[i][j] = 0;
            else down[i][j] = down[i + 1][j] + 1;
        }
    }

    for(int i = 1; i <= n; ++i) {
        for(int j = 1; j <= n; ++j) {
            dp[i][j] = -INF;
            prv[i][j] = nxt[i][j] = -1;
        }
    }

    for(int i = 1; i <= n; ++i) {
        int l = 1, r = 0;
        for(int j = 1; j <= n; ++j)

        while(l <= n) {
            r = l;

            if(grid[i][l] == 1) {
                while(r <= n && grid[i][r]) ++r;
                l = r + 1;
                continue;
            }

            while(r < n && grid[i][r + 1] == 0) ++r;

            stack<int> st;

            for(int j = l; j <= r; ++j) {
                while(st.size() && down[i][st.top()] > down[i][j]) {
                    prv[i][j] = st.top(); st.pop();
                }
                if(st.size()) nxt[i][st.top()] = j;
                st.push(j);
            }

            while(st.size() > 1) st.pop();

            magic(i, st.top(), l, r);
        }
    }

    return ans;
}

Details

/tmp/ccaWQGhZ.o: in function `magic(int, int, int, int)':
answer.code:(.text+0xc): relocation truncated to fit: R_X86_64_PC32 against symbol `down' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0x1d): relocation truncated to fit: R_X86_64_PC32 against symbol `prv' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0x84): relocation truncated to fit: R_X86_64_PC32 against symbol `prv' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0x99): relocation truncated to fit: R_X86_64_PC32 against symbol `down' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0xd3): relocation truncated to fit: R_X86_64_PC32 against symbol `nxt' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0x128): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `nxt' defined in .bss section in /tmp/ccaWQGhZ.o
answer.code:(.text+0x182): relocation truncated to fit: R_X86_64_PC32 against symbol `down' defined in .bss section in /tmp/ccaWQGhZ.o
/tmp/ccaWQGhZ.o: in function `biggest_stadium(int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)':
answer.code:(.text+0x1fc): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status