Submission #625417

# Submission time Handle Problem Language Result Execution time Memory
625417 2022-08-10T11:29:01 Z model_code Catfish Farm (IOI22_fish) C++17
9 / 100
59 ms 17020 KB
#include "fish.h"

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

const int kMaxN = 100'000;

long long dp[kMaxN][2][2];
int arr[kMaxN];
int N;

long long solve(int col, bool bef2, bool bef) {
  if (col == N) {
    return 0;
  }
  long long &ret = dp[col][bef2][bef];
  if (ret != -1) {
    return ret;
  }

  // skip
  ret = solve(col+1, bef, false);

  // take
  long long add = 0;
  if (col > 0 && bef) add -= arr[col];
  if (col > 0 && !bef2 && !bef) add += arr[col-1];
  if (col+1 < N) add += arr[col+1];
  ret = max(ret, add + solve(col+1, bef, true));

  return ret;
}

long long max_weights(int _N, int M, std::vector<int> X, std::vector<int>,
                      std::vector<int> W) {
  N = _N;
  for (int i = 0 ; i < M ; i++) {
    arr[X[i]] = W[i];
  }

  memset(dp, -1, sizeof dp);
  long long ret = solve(0, false, false);
  return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 13664 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 2 ms 3412 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 12 ms 12824 KB Output is correct
2 Correct 17 ms 12804 KB Output is correct
3 Correct 32 ms 14364 KB Output is correct
4 Correct 24 ms 14324 KB Output is correct
5 Correct 51 ms 15712 KB Output is correct
6 Correct 39 ms 16428 KB Output is correct
7 Correct 59 ms 16988 KB Output is correct
8 Correct 57 ms 17020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3420 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 2 ms 3420 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 2 ms 3420 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 12 ms 12824 KB Output is correct
2 Correct 17 ms 12804 KB Output is correct
3 Correct 32 ms 14364 KB Output is correct
4 Correct 24 ms 14324 KB Output is correct
5 Correct 51 ms 15712 KB Output is correct
6 Correct 39 ms 16428 KB Output is correct
7 Correct 59 ms 16988 KB Output is correct
8 Correct 57 ms 17020 KB Output is correct
9 Incorrect 40 ms 15676 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 41 ms 13664 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -