답안 #1079124

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079124 2024-08-28T11:01:48 Z ArthuroWich 메기 농장 (IOI22_fish) C++17
9 / 100
33 ms 25628 KB
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int max_weights(int32_t N, int32_t M, vector<int32_t> X, vector<int32_t> Y, vector<int32_t> W) {
    int n = N, m = M;
    vector<vector<int>> c(1, vector<int>(n+1, 0));
    vector<vector<vector<int>>> dp(1, vector<vector<int>>(n+1, vector<int>(2, 0)));
    for (int i = 0; i < m; i++) {
        c[Y[i]][X[i]] = W[i];
    }
    int i = 0;
    for (int j = 0; j < n; j++) {
        if (j-1 >= 0) {
            dp[i][j][0] = max(dp[i][j][0], dp[i][j-1][1]+c[i][j]);
            dp[i][j][0] = max(dp[i][j][0], dp[i][j-1][0]);
            dp[i][j][1] = max(dp[i][j][1], dp[i][j-1][1]);
        }
        if (j == 1) {
            dp[i][j][1] = max(dp[i][j][1], dp[i][j-1][0]+c[i][j-1]);
        }
        if (j-2 >= 0) {
            dp[i][j][1] = max(dp[i][j][1], dp[i][j-2][0]+c[i][j-1]);
            dp[i][j][1] = max(dp[i][j][1], dp[i][j-2][1]+c[i][j-1]);
        }
    }
    return max(dp[0][n-1][0], dp[0][n-1][1]);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 29 ms 21340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 12108 KB Output is correct
2 Correct 10 ms 11944 KB Output is correct
3 Correct 18 ms 12232 KB Output is correct
4 Correct 17 ms 12876 KB Output is correct
5 Correct 31 ms 14408 KB Output is correct
6 Correct 26 ms 15412 KB Output is correct
7 Correct 27 ms 15936 KB Output is correct
8 Correct 29 ms 16028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 12108 KB Output is correct
2 Correct 10 ms 11944 KB Output is correct
3 Correct 18 ms 12232 KB Output is correct
4 Correct 17 ms 12876 KB Output is correct
5 Correct 31 ms 14408 KB Output is correct
6 Correct 26 ms 15412 KB Output is correct
7 Correct 27 ms 15936 KB Output is correct
8 Correct 29 ms 16028 KB Output is correct
9 Runtime error 33 ms 25628 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 29 ms 21340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -