Submission #724341

# Submission time Handle Problem Language Result Execution time Memory
724341 2023-04-15T06:06:36 Z raul2008487 Catfish Farm (IOI22_fish) C++17
0 / 100
22 ms 2772 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[0]>W[1]){
        dp[1]=W[0];
    }
    else{
        dp[1]=W[1];
    }
    for(i=2;i<W.size();i++){
            if(dp[i-1]>(dp[i-2]+W[i])){
                dp[i]=dp[i-1];
            }
            else{
                dp[i]=dp[i-2]+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:15:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(i=2;i<W.size();i++){
      |             ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2772 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '23654541340850'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 13 ms 1960 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '15662963514162'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 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 212 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 212 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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 13 ms 1960 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '15662963514162'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2772 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '23654541340850'
2 Halted 0 ms 0 KB -