Submission #713404

# Submission time Handle Problem Language Result Execution time Memory
713404 2023-03-22T00:30:38 Z t6twotwo Catfish Farm (IOI22_fish) C++17
0 / 100
1000 ms 2097152 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
    vector w(N + 2, vector<ll>(N + 2));
    for (int i = 0; i < M; i++) {
        w[X[i] + 1][Y[i] + 2] = W[i];
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 2; j <= N + 1; j++) {
            w[i][j] += w[i][j - 1];
        }
    }
    vector dp1(N + 1, vector<ll>(N + 1));
    // for (int i = 1; i <= N; i++) {
    //     for (int j = 0; j <= N; j++) {
    //         for (int k = 0; k <= j; k++) {
    //             dp1[i][j] = max(dp1[i][j], dp1[i - 1][k] + w[i - 1][j + 2] - w[i - 1][k + 2]);
    //         }
    //     }
    // }
    vector dp2(N + 1, vector<ll>(N + 1));
    // for (int i = N - 1; i >= 0; i--) {
    //     for (int j = 0; j <= N; j++) {
    //         for (int k = 0; k <= j; k++) {
    //             dp2[i][j] = max(dp2[i][j], dp2[i + 1][k] + w[i + 2][j + 2] - w[i + 2][k + 2]);
    //         }
    //     }
    // }
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            ans = max(ans, dp1[i + 1][j] + dp2[i][j]);
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 855 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '2', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 2097152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 2097152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 855 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -