#include "fish.h"
#include <vector>
using namespace std;
using ll = long long;
ll max_weights(
int N, int M, vector<int> X, vector<int> Y, vector<int> W
) {
vector<ll> v(N+5);
for (int i = 0; i < M; i++)
v[X[i]+5] += W[i];
vector<ll> dp(N+5);
for (int i = 1; i < N; i++) {
dp[i+5] = max(
dp[i+5-1],
max(
dp[i+5-3] + v[i+5] + v[i-2+5],
dp[i+5-4] + v[i+5] + v[i-3+5]
)
);
}
return dp[N+4];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
4152 KB |
Output is correct |
2 |
Correct |
31 ms |
5220 KB |
Output is correct |
3 |
Correct |
1 ms |
1748 KB |
Output is correct |
4 |
Correct |
2 ms |
1748 KB |
Output is correct |
5 |
Correct |
92 ms |
10604 KB |
Output is correct |
6 |
Correct |
94 ms |
10632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Correct |
2 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
16 ms |
3192 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '20830673299350' |
4 |
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 |
Correct |
1 ms |
1748 KB |
Output is correct |
2 |
Correct |
2 ms |
1748 KB |
Output is correct |
3 |
Incorrect |
16 ms |
3192 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '20830673299350' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
4152 KB |
Output is correct |
2 |
Correct |
31 ms |
5220 KB |
Output is correct |
3 |
Correct |
1 ms |
1748 KB |
Output is correct |
4 |
Correct |
2 ms |
1748 KB |
Output is correct |
5 |
Correct |
92 ms |
10604 KB |
Output is correct |
6 |
Correct |
94 ms |
10632 KB |
Output is correct |
7 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
8 |
Halted |
0 ms |
0 KB |
- |