Submission #1079120

# Submission time Handle Problem Language Result Execution time Memory
1079120 2024-08-28T11:00:21 Z ArthuroWich Catfish Farm (IOI22_fish) C++17
0 / 100
30 ms 21340 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][0], dp[0][n][1]);
}
# Verdict Execution time Memory Grader output
1 Runtime error 28 ms 21340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 12100 KB Output is correct
2 Correct 11 ms 12108 KB Output is correct
3 Correct 17 ms 12188 KB Output is correct
4 Correct 24 ms 12876 KB Output is correct
5 Incorrect 30 ms 14412 KB 1st lines differ - on the 1st token, expected: '1673106170551', found: '1673122841934'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 12100 KB Output is correct
2 Correct 11 ms 12108 KB Output is correct
3 Correct 17 ms 12188 KB Output is correct
4 Correct 24 ms 12876 KB Output is correct
5 Incorrect 30 ms 14412 KB 1st lines differ - on the 1st token, expected: '1673106170551', found: '1673122841934'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 28 ms 21340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -