#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#include <vector>
#define ll long long
const int MN=1e6;
ll a[MN];
ll dp[MN][2];
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
for(int i=0;i<M;i++){
a[X[i]]+=W[i];
}
dp[0][1]=a[0];
dp[0][0]=0;
for(int i=1;i<=N;i++){
dp[i][1]=max(dp[i-1][0]+a[i],dp[i][1]);
dp[i+1][0]=max(dp[i+1][0],max(dp[i-1][0],dp[i-1][1])+a[i]);
dp[i][0]=max(dp[i-1][0],dp[i-1][1]);
}
return max(dp[N][0],dp[N][1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
5752 KB |
Output is correct |
2 |
Correct |
15 ms |
6244 KB |
Output is correct |
3 |
Correct |
1 ms |
3932 KB |
Output is correct |
4 |
Correct |
1 ms |
3932 KB |
Output is correct |
5 |
Correct |
46 ms |
10884 KB |
Output is correct |
6 |
Correct |
46 ms |
10880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 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 |
3932 KB |
Output is correct |
2 |
Correct |
1 ms |
3932 KB |
Output is correct |
3 |
Incorrect |
9 ms |
4952 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 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 |
1 ms |
2396 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 |
1 ms |
2396 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 |
3932 KB |
Output is correct |
2 |
Correct |
1 ms |
3932 KB |
Output is correct |
3 |
Incorrect |
9 ms |
4952 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
5752 KB |
Output is correct |
2 |
Correct |
15 ms |
6244 KB |
Output is correct |
3 |
Correct |
1 ms |
3932 KB |
Output is correct |
4 |
Correct |
1 ms |
3932 KB |
Output is correct |
5 |
Correct |
46 ms |
10884 KB |
Output is correct |
6 |
Correct |
46 ms |
10880 KB |
Output is correct |
7 |
Incorrect |
1 ms |
2396 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
8 |
Halted |
0 ms |
0 KB |
- |