답안 #632940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
632940 2022-08-21T09:17:21 Z stefanlin 메기 농장 (IOI22_fish) C++17
0 / 100
21 ms 3676 KB
#include "fish.h"

#include <vector>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <cstring>

bool locatedAt0(std::vector<int> Y) {
    for (auto y : Y) {
        if (y != 0) {
            return false;
        }
    }
    return true;
}

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
    if (locatedAt0(Y)) {
        int64_t a[N + 1];
        int64_t dp[N + 1][2];
        memset(a, 0, sizeof a);
        memset(dp, 0, sizeof dp);
        for (int i = 0; i < M; ++i) {
            a[X[i]] = W[i];
        }
        dp[0][0] = 0;
        dp[0][1] = a[1];
        dp[1][0] = a[1];
        dp[1][1] = a[0] + a[2];
        for (int i = 2; i < N; ++i) {
            dp[i][0] = std::max(dp[i - 1][1], dp[i - 1][0]),
            dp[i][1] = std::max(dp[i - 2][0] + a[i - 1] + a[i + 1], dp[i - 2][1] + a[i + 1]);
        }
        return std::max(dp[N - 1][0], dp[N - 1][1]);
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 2380 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '2', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Incorrect 15 ms 3676 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '21049836049923'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Incorrect 15 ms 3676 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '21049836049923'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 2380 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '0'
2 Halted 0 ms 0 KB -