This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ln '\n'
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
std::vector<int> W) {
ll a[N+3]; memset(a, 0, sizeof(a));
for (int i = 0; i < M; i++){
a[X[i]+3] = W[i];
}
ll dp[N+3]; memset(dp, 0, sizeof(dp));
for (int i = 0+3; i < N+3; i++){
dp[i] = max(dp[i-1], max(
a[i-1] + dp[i-2],
a[i] + a[i-2] + dp[i-3]));
// cout << dp[i] << ln;
}
// cout << dp[N+2] << ln;
return dp[N+2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |