Submission #1053747

# Submission time Handle Problem Language Result Execution time Memory
1053747 2024-08-11T16:46:03 Z jer033 Catfish Farm (IOI22_fish) C++17
9 / 100
16 ms 5824 KB
#include "fish.h"
#include <bits/stdc++.h>
#include <vector>
using ll = long long;
using namespace std;

long long max_weights_st1(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
    long long y = 0;
    for (int i=0; i<M; i++)
    {
        long long x = W[i];
        y+=x;
    }
    return y;
}

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
    vector<long long> fish(N, 0);
    //we can consider empty cells to have catfish worth 0
    for (int i=0; i<M; i++)
        fish[X[i]] = W[i];
    vector<ll> dp(N, 0);
    dp[1] = max(fish[0], fish[1]);
    if (N==2)
        return dp[1];
    dp[2] = max(fish[0]+fish[2], fish[1]);
    if (N==3)
        return dp[2];
    dp[3] = max(fish[0], fish[1]) + max(fish[2], fish[3]);
    if (N==4)
        return dp[3];
    for (int i=4; i<N; i++)
    {
        dp[i] = max(dp[i-4]+fish[i-3]+fish[i], max(dp[i-3]+fish[i-2]+fish[i], dp[i-2]+fish[i-1]));
    }
    return dp[N-1];
}
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 3672 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1884 KB Output is correct
2 Correct 1 ms 1884 KB Output is correct
3 Correct 8 ms 2908 KB Output is correct
4 Correct 6 ms 3292 KB Output is correct
5 Correct 14 ms 5824 KB Output is correct
6 Correct 13 ms 5212 KB Output is correct
7 Correct 14 ms 5824 KB Output is correct
8 Correct 16 ms 5824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1884 KB Output is correct
2 Correct 1 ms 1884 KB Output is correct
3 Correct 8 ms 2908 KB Output is correct
4 Correct 6 ms 3292 KB Output is correct
5 Correct 14 ms 5824 KB Output is correct
6 Correct 13 ms 5212 KB Output is correct
7 Correct 14 ms 5824 KB Output is correct
8 Correct 16 ms 5824 KB Output is correct
9 Incorrect 13 ms 5468 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 3672 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -