Submission #870678

# Submission time Handle Problem Language Result Execution time Memory
870678 2023-11-08T19:55:03 Z Ludissey Catfish Farm (IOI22_fish) C++17
0 / 100
41 ms 23900 KB
#include "fish.h"
#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<int> a;
vector<vector<vector<int>>> memo;
int N,M;
int dp(int x, int last, int lastlast){
  if(x>N) return 0; 
  if(memo[x][last][lastlast]!=-1) return memo[x][last][lastlast];
  if(x==N){
    if(!last&&lastlast) return a[x-1];
    return 0;
  }
  int take=dp(x+1, 1, last);
  if(!last&&x>0) take+=a[x-1];
  int notake=dp(x+1, 0, last);
  if(lastlast==1) notake+=a[x-1]; 
  return memo[x][last][lastlast] = max(take, notake);
}

long long max_weights(signed n, signed m, std::vector<signed> X, std::vector<signed> Y, std::vector<signed> W) {
  N=n; M=m;
  a.resize(N, 0);
  memo.resize(N+1, vector<vector<int>>(2, vector<int>(2,-1)));
  for (int i = 0; i < M; i++) a[X[i]] = W[i];
  int p=dp(0,0,0);
  return p;
}
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 23376 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 344 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 22 ms 23836 KB Output is correct
2 Correct 21 ms 23900 KB Output is correct
3 Incorrect 41 ms 23660 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '23377109270875'
4 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 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 22 ms 23836 KB Output is correct
2 Correct 21 ms 23900 KB Output is correct
3 Incorrect 41 ms 23660 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '23377109270875'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 23376 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -