#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
const int nax = 100000;
long long fish[nax];
long long dp[nax][2];
int n;
long long solve(int i, int mask) {
if(i==n) return 0LL;
long long &ret = dp[i][mask];
if(ret!=-1) return ret;
ret = solve(i+1, 1);
if(mask) ret = max(ret, solve(i+1, 0) + fish[i]);
else if(i < n-1) ret = max(ret, solve(i+2, 1) + fish[i]);
return ret;
}
long long max_weights(int N, int M, vector<int> X, vector<int> Y,
vector<int> W) {
n = N;
for(int i=0; i<M; ++i) {
fish[X[i]] = W[i];
}
memset(dp, -1, sizeof dp);
return solve(0, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
9428 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1844 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 |
5 ms |
8020 KB |
Output is correct |
2 |
Correct |
5 ms |
8020 KB |
Output is correct |
3 |
Correct |
17 ms |
9684 KB |
Output is correct |
4 |
Correct |
14 ms |
10068 KB |
Output is correct |
5 |
Correct |
27 ms |
12876 KB |
Output is correct |
6 |
Correct |
25 ms |
12116 KB |
Output is correct |
7 |
Correct |
28 ms |
12732 KB |
Output is correct |
8 |
Correct |
27 ms |
12728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1844 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 |
1844 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 |
1844 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 |
5 ms |
8020 KB |
Output is correct |
2 |
Correct |
5 ms |
8020 KB |
Output is correct |
3 |
Correct |
17 ms |
9684 KB |
Output is correct |
4 |
Correct |
14 ms |
10068 KB |
Output is correct |
5 |
Correct |
27 ms |
12876 KB |
Output is correct |
6 |
Correct |
25 ms |
12116 KB |
Output is correct |
7 |
Correct |
28 ms |
12732 KB |
Output is correct |
8 |
Correct |
27 ms |
12728 KB |
Output is correct |
9 |
Incorrect |
31 ms |
12596 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 |
22 ms |
9428 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |