#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
std::vector<int> W) {
vector<ll> dp1(N + 1), dp2(N + 1);
vector<ll> c(N + 1);
for (int i = 0; i < M; ++i) {
c[X[i]] += W[i];
}
// for (auto& u : c) {
// cout << u << " ";
// }
// cout << "\n";
dp1[0] = 0;
dp2[0] = c[0];
for (int i = 1; i < N + 1; ++i) {
dp2[i] = max(dp2[i], dp1[i - 1] + c[i]);
dp1[i] = max(dp1[i], max(dp1[i - 1], dp2[i - 1]));
}
for (auto& u : dp1) {
cerr << setw(5) << left << u << " ";
}
cerr << "\n";
for (auto& u : dp2) {
cerr << setw(5) << left << u << " ";
}
cerr << "\n";
return max(dp1[N], dp2[N]);
}
# | 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... |