답안 #1082366

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1082366 2024-08-31T08:23:16 Z jer033 메기 농장 (IOI22_fish) C++17
0 / 100
873 ms 2097152 KB
#include "fish.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
using ll = long long;
const ll NINF = -5'000'000'000'000'000;

ll dp[450][15][15][15];

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
    vector<vector<ll>> fish(N, vector<ll> (N, 0));
    //we can consider empty cells to have catfish worth 0
    for (int i=0; i<M; i++)
        fish[X[i]][Y[i]] = W[i];
    ll ans = 0;
    for (int r = 0; r < N; r++)
    {
        for (int i=0; i<=8; i++)
            for (int j=0; j<=8; j++)
                for (int k=0; k<=8; k++)
                {
                    ll history;
                    ll current;
                    
                    history = 0;
                    if (r!=0)
                    {
                        for (int guess = 0; guess<=8; guess++)
                            history = max(history, dp[r-1][guess][i][j]);
                    }

                    if ((r==0) and (i!=0))
                        current = NINF;
                    else if ((r==(N-1)) and (k!=0))
                        current = NINF;
                    else
                    {
                        current = 0;
                        int reach = max(i, k);
                        int start = j;
                        for (int fishy = start+1; fishy<=reach; fishy++)
                            current += fish[r][fishy];
                    }
                    dp[r][i][j][k] = history+current;
                    ans = max(ans, history+current);
                }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 873 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '2', found: '117730'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 844 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '58772'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '58772'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '58772'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 844 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 873 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -