답안 #1079145

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079145 2024-08-28T11:14:15 Z ArthuroWich 메기 농장 (IOI22_fish) C++17
9 / 100
29 ms 22588 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<int>> dp(9, vector<int>(n+1, 0));
    for (int i = 0; i < m; i++) {
        c[Y[i]][X[i]] = W[i];
    }
    for (int j = 0; j < n; j++) {
        if (j-1 >= 0) {
            dp[0][j] = max(dp[0][j], dp[1][j-1]+c[0][j]);
            dp[0][j] = max(dp[0][j], dp[0][j-1]);
            dp[1][j] = max(dp[1][j], dp[1][j-1]);
        }
        if (j == 1) {
            dp[1][j] = max(dp[1][j], dp[0][j-1]+c[0][j-1]);
        }
        if (j-2 >= 0) {
            dp[1][j] = max(dp[1][j], dp[0][j-2]+c[0][j-1]);
            dp[1][j] = max(dp[1][j], dp[1][j-2]+c[0][j-1]);
        }
    }
    return max(dp[0][n-1], dp[1][n-1]);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 26 ms 20124 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 4 ms 9032 KB Output is correct
2 Correct 5 ms 9036 KB Output is correct
3 Correct 13 ms 9340 KB Output is correct
4 Correct 11 ms 9800 KB Output is correct
5 Correct 20 ms 11340 KB Output is correct
6 Correct 19 ms 11340 KB Output is correct
7 Correct 21 ms 11328 KB Output is correct
8 Correct 21 ms 11360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 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 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 9032 KB Output is correct
2 Correct 5 ms 9036 KB Output is correct
3 Correct 13 ms 9340 KB Output is correct
4 Correct 11 ms 9800 KB Output is correct
5 Correct 20 ms 11340 KB Output is correct
6 Correct 19 ms 11340 KB Output is correct
7 Correct 21 ms 11328 KB Output is correct
8 Correct 21 ms 11360 KB Output is correct
9 Runtime error 29 ms 22588 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 26 ms 20124 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -