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 <bits/stdc++.h>
#define pb push_back
#define int int64_t
using namespace std;
int max_weights(int32_t n, int32_t m, vector<int32_t> x, vector<int32_t> y, vector<int32_t> w)
{
vector<int> v(n);
for (int i = 0; i < m; i++)
v[x[i]] = w[i];
vector<vector<int>> dp(n, vector<int>(3));
for (int i = 1; i < n; i++)
{
dp[i][0] = max({dp[i-1][0], dp[i-1][1] + w[i-1], dp[i-1][2]});
dp[i][1] = max({dp[i-1][1], dp[i-1][2]});
dp[i][2] = max({dp[i-1][0] + w[i]});
}
return max({dp[n-1][0], dp[n-1][1], dp[n-1][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... |