답안 #991806

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991806 2024-06-03T07:37:57 Z thinknoexit 메기 농장 (IOI22_fish) C++17
14 / 100
1000 ms 151764 KB
#include <bits/stdc++.h>
#include "fish.h"
using namespace std;
using ll = long long;
int a[3030][3030];
/*
0 -> Increasing
1 -> Decreasing
2 -> No Poles
*/
ll dp[3][3030][3030];
int n, m;
ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
    n = N, m = M;
    for (int i = 0;i < m;i++) {
        a[X[i] + 1][Y[i] + 1] = W[i];
    }
    ll mx, mx2;
    for (int i = 2;i <= n;i++) {
        // (1)
        mx = 0;
        for (int j = 0;j <= n;j++) {
            mx = max({ mx + a[i - 1][j], dp[0][i - 1][j], dp[2][i - 1][j] });
            dp[0][i][j] = mx;
        }
        mx = 0;
        for (int j = n;j >= 0;j--) {
            mx = max(mx, dp[2][i - 1][j]);
            dp[0][i][j] = max(dp[0][i][j], mx);
        }
        // (2)
        mx = 0, mx2 = 0;
        for (int j = n;j >= 0;j--) {
            mx2 = max(mx2, dp[2][i - 1][j]);
            dp[1][i][j] = max(mx, mx2);
            mx = max({ mx + a[i][j], dp[0][i - 1][j], dp[1][i - 1][j] });
        }
        mx = 0;
        for (int j = 0;j <= n;j++) {
            mx = max(mx + a[i - 1][j], dp[2][i - 1][j]);
            dp[1][i][j] = max(dp[1][i][j], mx);
        }
        // (3)
        mx = 0;
        for (int j = 0;j <= n;j++) {
            mx += a[i][j];
            dp[2][i][j] = max(dp[0][i - 1][j], dp[1][i - 1][j]) + mx;
        }
    }
    ll ans = 0;
    for (int i = 1;i <= n;i++) {
        for (int j = 0;j <= n;j++) {
            ans = max(ans, dp[0][i][j]);
            ans = max(ans, dp[1][i][j]);
            ans = max(ans, dp[2][i][j]);
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 143028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Execution timed out 1084 ms 151764 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 125780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 12632 KB Output is correct
3 Correct 1 ms 4540 KB Output is correct
4 Correct 1 ms 4536 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 2 ms 18780 KB Output is correct
10 Correct 4 ms 33116 KB Output is correct
11 Correct 2 ms 18780 KB Output is correct
12 Correct 4 ms 33112 KB Output is correct
13 Correct 1 ms 12636 KB Output is correct
14 Correct 4 ms 33112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 12632 KB Output is correct
3 Correct 1 ms 4540 KB Output is correct
4 Correct 1 ms 4536 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 2 ms 18780 KB Output is correct
10 Correct 4 ms 33116 KB Output is correct
11 Correct 2 ms 18780 KB Output is correct
12 Correct 4 ms 33112 KB Output is correct
13 Correct 1 ms 12636 KB Output is correct
14 Correct 4 ms 33112 KB Output is correct
15 Correct 4 ms 33112 KB Output is correct
16 Incorrect 2 ms 10588 KB 1st lines differ - on the 1st token, expected: '741526820812', found: '741108410737'
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 12632 KB Output is correct
3 Correct 1 ms 4540 KB Output is correct
4 Correct 1 ms 4536 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 2 ms 18780 KB Output is correct
10 Correct 4 ms 33116 KB Output is correct
11 Correct 2 ms 18780 KB Output is correct
12 Correct 4 ms 33112 KB Output is correct
13 Correct 1 ms 12636 KB Output is correct
14 Correct 4 ms 33112 KB Output is correct
15 Correct 4 ms 33112 KB Output is correct
16 Incorrect 2 ms 10588 KB 1st lines differ - on the 1st token, expected: '741526820812', found: '741108410737'
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 125780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 143028 KB Time limit exceeded
2 Halted 0 ms 0 KB -