Submission #1036755

# Submission time Handle Problem Language Result Execution time Memory
1036755 2024-07-27T16:21:16 Z thatsgonzalez Catfish Farm (IOI22_fish) C++17
9 / 100
18 ms 7772 KB
#include "fish.h"

#include <vector>
#include <bits/stdc++.h>
using namespace std;

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
   int line[N+1]; for(auto &x: line) x = 0;

  for(int i = 0; i<M; i++){
    line[X[i]] = W[i];
  }

  long long dp[4][N]; for(auto &item: dp) for(auto &cell: item) cell = 0;

  /*
    0 : xx
    1 : xy
    2 : yx
    3 : yy
  */

  dp[0][0] = dp[2][0] = 0;
  dp[1][0] = dp[3][0] = 0;
  dp[0][1] = 0; dp[1][1] = line[0]; dp[2][1] = line[1]; dp[3][1] = 0; 
  
  for(int i = 2; i<N; i++){
    dp[0][i] = max(dp[0][i-1], dp[2][i-1]);
    dp[1][i] = max(dp[0][i-1]+line[i-1], dp[2][i-1]);
    dp[2][i] = max(dp[1][i-1]+line[i], dp[3][i-1]+line[i]);
    dp[3][i] = max(dp[1][i-1], dp[3][i-1]);
  }

  return max({dp[0][N-1],dp[1][N-1],dp[2][N-1],dp[3][N-1]});
}
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 6736 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 348 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 2 ms 3932 KB Output is correct
2 Correct 2 ms 3932 KB Output is correct
3 Correct 11 ms 5804 KB Output is correct
4 Correct 9 ms 5212 KB Output is correct
5 Correct 18 ms 7772 KB Output is correct
6 Correct 15 ms 7260 KB Output is correct
7 Correct 17 ms 7768 KB Output is correct
8 Correct 18 ms 7772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 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 348 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 348 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 2 ms 3932 KB Output is correct
2 Correct 2 ms 3932 KB Output is correct
3 Correct 11 ms 5804 KB Output is correct
4 Correct 9 ms 5212 KB Output is correct
5 Correct 18 ms 7772 KB Output is correct
6 Correct 15 ms 7260 KB Output is correct
7 Correct 17 ms 7768 KB Output is correct
8 Correct 18 ms 7772 KB Output is correct
9 Incorrect 17 ms 7516 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 6736 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -