제출 #1177799

#제출 시각아이디문제언어결과실행 시간메모리
1177799PagodePaiva메기 농장 (IOI22_fish)C++20
0 / 100
28 ms5192 KiB
#include "fish.h"
#include<bits/stdc++.h>
#define ll long long

using namespace std;

const int N = 310;
const int MAXY = 10;
ll dp[N][MAXY][MAXY];
ll mat[N][N];

long long calc(int i, int y1, int y2,int y3){
    ll sum = 0;
    for(int j = y1;j <= y2;j++){
        sum += mat[i][j];
    }
    for(int j = max(y1, y3);j > max(y2, y3);j--){
        sum += mat[i+1][j];
    }
    return sum;
}
long long max_weights(int n, int m, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
    for(int i = 0;i < m;i++){
        mat[X[i]+1][Y[i]+1] = W[i];
    }
    for(int i = 0;i < MAXY;i++){
        for(int j = 0;j < MAXY;j++){
            dp[0][i][j] = 0;
        }
    }
    for(int i = 1;i <= n;i++){
        for(int y1 = 0;y1 < MAXY;y1++){
            for(int y2 = 0;y2 < MAXY;y2++){
                for(int k = 0;k < MAXY;k++){
                    dp[i][y1][y2] = max(dp[i][y1][y2], dp[i-1][k][y1]+calc(i, k+1, y1, y2));
                }
            }
        }
    }
    return dp[n][0][0];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...