Submission #1056661

# Submission time Handle Problem Language Result Execution time Memory
1056661 2024-08-13T10:30:29 Z MercubytheFirst Catfish Farm (IOI22_fish) C++17
0 / 100
22 ms 3608 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1e9 + 37;


long long max_weights(signed N, signed M, vector<signed> X, vector<signed> Y, vector<signed> W) {
  W.push_back(0);
  vector<ll> dp(M), ydx(N + 1, M);
  for(int i = 0; i < M; ++i) {
    ydx[Y[i]] = i;
  }
  for(ll i = 0; i < N; ++i) {
    dp[i] = W[ydx[i + 1]] + (i > 0 ? W[ydx[i - 1]] : 0);
    if(i > 0) {
      dp[i] = max(dp[i], dp[i - 1] + W[ydx[i + 1]]);
    }
    if(i > 1) {
      dp[i] = max(dp[i], dp[i - 2] + W[ydx[i + 1]]);
    }
  }
  return *max_element(dp.begin(), dp.end());
}
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 3608 KB Execution killed with signal 11
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 Runtime error 2 ms 2140 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 2140 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 3608 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -