#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define FOR(i,a,b) for(int i = a; i < b; i++)
ll max_weights(int N, int M, vi X, vi Y, vi W) {
vector<ll> A(N);
FOR(i,0,M){
A[X[i]] = W[i];
}
ll dp[N][2]; memset(dp,0,sizeof(dp));
if (N>1){
dp[1][0] = A[1];
dp[1][1] = A[0];
}
FOR(i,2,N){
dp[i][0] = dp[i-1][1] + A[i];
dp[i][1] = max(max(dp[i-1][1], dp[i-1][0]), dp[i-2][0] + A[i-1]);
}
return max(dp[N-1][0], dp[N-1][1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
4308 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 |
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 |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
22 ms |
3660 KB |
Output is correct |
4 |
Correct |
12 ms |
3788 KB |
Output is correct |
5 |
Correct |
29 ms |
5088 KB |
Output is correct |
6 |
Correct |
25 ms |
5940 KB |
Output is correct |
7 |
Correct |
28 ms |
6448 KB |
Output is correct |
8 |
Correct |
37 ms |
6444 KB |
Output is correct |
# |
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 |
3 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
22 ms |
3660 KB |
Output is correct |
4 |
Correct |
12 ms |
3788 KB |
Output is correct |
5 |
Correct |
29 ms |
5088 KB |
Output is correct |
6 |
Correct |
25 ms |
5940 KB |
Output is correct |
7 |
Correct |
28 ms |
6448 KB |
Output is correct |
8 |
Correct |
37 ms |
6444 KB |
Output is correct |
9 |
Incorrect |
29 ms |
5848 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 |
24 ms |
4308 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |