답안 #991793

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991793 2024-06-03T07:19:35 Z thinknoexit 메기 농장 (IOI22_fish) C++17
0 / 100
1000 ms 187224 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];
    }
    for (int j = 1;j <= n;j++) dp[2][1][j] = dp[2][1][j - 1] + a[1][j];
    ll mx;
    for (int i = 2;i <= n;i++) {
        // h[i-1] <= h[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;
        }
        // h[i-1] >= h[i] (2)
        mx = 0;
        for (int j = n;j >= 0;j--) {
            dp[1][i][j] = mx;
            mx = max({ mx + a[i][j],dp[0][i - 1][j], dp[1][i - 1][j] });
        }
        // (3)
        mx = 0;
        ll sum = 0;
        for (int j = 0;j <= n;j++) {
            sum += a[i][j];
            mx = max({ mx, dp[0][i - 1][j], dp[1][i - 1][j] });
            dp[2][i][j] = mx + sum;
        }
    }
    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]);
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1042 ms 185168 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Execution timed out 1062 ms 187224 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 168944 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 12636 KB Output is correct
3 Correct 1 ms 4568 KB Output is correct
4 Correct 0 ms 4444 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 Incorrect 1 ms 4444 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 12636 KB Output is correct
3 Correct 1 ms 4568 KB Output is correct
4 Correct 0 ms 4444 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 Incorrect 1 ms 4444 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6492 KB Output is correct
2 Correct 1 ms 12636 KB Output is correct
3 Correct 1 ms 4568 KB Output is correct
4 Correct 0 ms 4444 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 Incorrect 1 ms 4444 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 168944 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1042 ms 185168 KB Time limit exceeded
2 Halted 0 ms 0 KB -