#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 |
1 |
Incorrect |
28 ms |
7764 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '34455709198970' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 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 |
Incorrect |
8 ms |
6556 KB |
1st lines differ - on the 1st token, expected: '10082010', found: '23425106453410' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 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 |
0 ms |
212 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 |
0 ms |
212 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 |
8 ms |
6556 KB |
1st lines differ - on the 1st token, expected: '10082010', found: '23425106453410' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
7764 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '34455709198970' |
2 |
Halted |
0 ms |
0 KB |
- |