#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
vector<int>vp(N);
vp.assign(N,0);
for(int i=0;i<M;i++){
vp[X[i]]+=W[i];
}
long long dp[N][2];
dp[0][0]=0;
dp[0][1]=vp[0];
dp[1][0]=max(vp[1],vp[0]);
dp[1][1]=max(vp[1],vp[0]);
for(int i=2;i<N;i++){
dp[i][1]=max(dp[i-1][1],dp[i-1][0]+vp[i]);
dp[i][0]=max(dp[i-1][1],max(dp[i-2][1]+vp[i],dp[i-2][0]+vp[i-1]));
}
return dp[N-1][0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
5468 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '709728670' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 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 |
2 ms |
2396 KB |
Output is correct |
2 |
Correct |
2 ms |
2396 KB |
Output is correct |
3 |
Correct |
11 ms |
4284 KB |
Output is correct |
4 |
Correct |
8 ms |
3672 KB |
Output is correct |
5 |
Correct |
18 ms |
6228 KB |
Output is correct |
6 |
Correct |
15 ms |
5468 KB |
Output is correct |
7 |
Correct |
18 ms |
6068 KB |
Output is correct |
8 |
Correct |
18 ms |
6228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 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 |
348 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 |
348 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 |
2 ms |
2396 KB |
Output is correct |
2 |
Correct |
2 ms |
2396 KB |
Output is correct |
3 |
Correct |
11 ms |
4284 KB |
Output is correct |
4 |
Correct |
8 ms |
3672 KB |
Output is correct |
5 |
Correct |
18 ms |
6228 KB |
Output is correct |
6 |
Correct |
15 ms |
5468 KB |
Output is correct |
7 |
Correct |
18 ms |
6068 KB |
Output is correct |
8 |
Correct |
18 ms |
6228 KB |
Output is correct |
9 |
Incorrect |
17 ms |
5976 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
5468 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '709728670' |
2 |
Halted |
0 ms |
0 KB |
- |