답안 #1053741

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1053741 2024-08-11T16:39:07 Z jer033 메기 농장 (IOI22_fish) C++17
0 / 100
12 ms 3672 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];
    if (N==2)
        return max(fish[0], fish[1]);
    vector<ll> dp(N, 0);
    dp[1] = max(fish[0], fish[1]);
    dp[2] = max(fish[0]+fish[2], fish[1]);
    for (int i=3; i<N; i++)
    {
        dp[i] = max(fish[i], fish[i-1])+dp[i-2];
    }
    return dp[N-1];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 3672 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1884 KB Output is correct
2 Correct 1 ms 1884 KB Output is correct
3 Incorrect 10 ms 3128 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '18638426278373'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1884 KB Output is correct
2 Correct 1 ms 1884 KB Output is correct
3 Incorrect 10 ms 3128 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '18638426278373'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 3672 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -