Submission #1044994

# Submission time Handle Problem Language Result Execution time Memory
1044994 2024-08-05T15:27:42 Z ender Catfish Farm (IOI22_fish) C++17
0 / 100
13 ms 6892 KB
#include "fish.h"
#include <bits/stdc++.h>
#include <vector>

using namespace std;

const long long INF = 1e18;

const int MAXN = 1e5;

int n;

long long memo[MAXN];
bool cached[MAXN];

int a[MAXN];

long long dp(int i, bool check){

  if(i >= n) return 0;

  if(cached[i]) return memo[i];

  long long res = -INF;

  if(check){

    long long act1 = dp(i+2, true) + a[i+1];
    long long act2 = dp(i+1, false);

    res = max({res, act1, act2});

  } else {

    long long act1 = dp(i+2, true) + a[i+1] + a[i-1];
    long long act2 = dp(i+1, false);

    res = max({res, act1, act2});

  }


  memo[i] = res;
  cached[i] = true;

  return res;

}

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {

  n = N;

  for(int i = 0; i < n; ++i) a[i] = 0;

  for(int i = 0; i<M; ++i){

    a[X[i]] = W[i];

  }

  return dp(0, true);

}
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 6892 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 3 ms 3928 KB Output is correct
2 Correct 2 ms 3928 KB Output is correct
3 Incorrect 9 ms 4956 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '27384291159897'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3928 KB Output is correct
2 Correct 2 ms 3928 KB Output is correct
3 Incorrect 9 ms 4956 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '27384291159897'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 6892 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -