QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#462552#6660. 택시 여행thangthangCompile Error//C++201.5kb2024-07-03 20:48:032024-07-03 20:48:04

Judging History

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

  • [2024-07-03 20:48:04]
  • 评测
  • [2024-07-03 20:48:03]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 1e3 + 5;

int n, a[N][N], dp[4][N][N];
int ans = -2e9;

int max_item_sum(vector <vector <int>> V){
    n = V.size();
    for (int i = 1; i <= n; ++ i) for (int j = 1; j <= n; ++ j) a[i][j] = V[i - 1][j - 1];

    for (int i = 1; i <= n; ++ i){
        for (int j = n; j >= 1; -- j){
            dp[1][i][j] = max(dp[0][i - 1][j], dp[0][i][j + 1]) + a[i][j];
        }
    }

    for (int i = n; i >= 1; -- i){
        for (int j = 1; j <= n; ++ j){
            dp[2][i][j] = max(dp[1][i + 1][j], dp[1][i][j - 1]) + a[i][j];
        }
    }

    for (int i = 1; i <= n; ++ i){
        for (int j = 1; j <= n; ++ j){
            dp[0][i][j] = max(dp[0][i][j - 1], dp[0][i - 1][j]) + a[i][j];
         }
    }

    for (int i = n; i >= 1; -- i){
        for (int j = n; j >= 1; -- j){
            dp[3][i][j] = max(dp[3][i + 1][j], dp[3][i][j + 1]) + a[i][j];
        }
    }

    for (int i = 1; i <= n; ++ i){
        int pre = -2e9;
        for (int j = 1; j <= n; ++ j){
            pre = max(pre, dp[0][i - 1][j] + dp[2][i + 1][j]) + a[i][j];
            ans = max(ans, pre + dp[1][i - 1][j] + dp[3][i + 1][j]);
        }
    }

    for (int j = 1; j <= n; ++ j){
        int pre = -2e9;
        for (int i = 1; i <= n; ++ i){
            pre = max(pre, dp[0][i][j - 1] + dp[1][i][j + 1]) + a[i][j];
            ans = max(ans, pre + dp[2][i][j - 1] + dp[3][i][j + 1]);
        }
    }

    return ans;
}

详细

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