답안 #724347

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
724347 2023-04-15T06:10:39 Z raul2008487 메기 농장 (IOI22_fish) C++17
3 / 100
85 ms 9560 KB
#include "fish.h"

#include <vector>

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
    long long dp[W.size()];
    long long i;
    dp[0]=W[0];
    if(W[1]-W[0]==1){
        if(W[0]>W[1]){
        dp[1]=W[0];
    }
    else{
        dp[1]=W[1];
    }
    }
    else{
        dp[1]=W[0]+W[1];
    }
    for(i=2;i<W.size();i++){
            if(W[i]-W[i-1]==1){
                if(dp[i-1]>(dp[i-2]+W[i])){
                dp[i]=dp[i-1];
            }
            else{
                dp[i]=dp[i-2]+W[i];
            }
            }
            else{
                dp[i]=dp[i-1]+W[i];
            }
        //dp[i]=max(dp[i-1],dp[i-2]+W[i]);
    }
    return dp[W.size()-1];
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:20:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(i=2;i<W.size();i++){
      |             ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 2772 KB Output is correct
2 Correct 26 ms 3388 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 80 ms 9556 KB Output is correct
6 Correct 85 ms 9560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 49 ms 5272 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '80901044391025'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 14 ms 1952 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 14 ms 1952 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 2772 KB Output is correct
2 Correct 26 ms 3388 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 80 ms 9556 KB Output is correct
6 Correct 85 ms 9560 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 49 ms 5272 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '80901044391025'
9 Halted 0 ms 0 KB -