#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
long long max_weights(int N, int M,vector<int> X,vector<int> Y,
vector<int> W){
vector<long long> arr(N+1);
vector DP(N+1,vector(2,0ll));
for(int i=0;i<M;i++) {
arr[X[i]+1]=W[i];
}
for(int i=2;i<=N;i++) {
DP[i][0]=max(DP[i-1][0],DP[i-1][1]+arr[i]);
DP[i][1]=max(DP[i-1][1],max(DP[i-2][1],DP[i-2][0])+arr[i-1]);
}
return max(DP[N][0],DP[N][1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
7772 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
6492 KB |
Output is correct |
2 |
Correct |
5 ms |
6492 KB |
Output is correct |
3 |
Correct |
15 ms |
7260 KB |
Output is correct |
4 |
Correct |
11 ms |
8028 KB |
Output is correct |
5 |
Correct |
41 ms |
10564 KB |
Output is correct |
6 |
Correct |
18 ms |
9916 KB |
Output is correct |
7 |
Correct |
21 ms |
10588 KB |
Output is correct |
8 |
Correct |
22 ms |
10564 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
6492 KB |
Output is correct |
2 |
Correct |
5 ms |
6492 KB |
Output is correct |
3 |
Correct |
15 ms |
7260 KB |
Output is correct |
4 |
Correct |
11 ms |
8028 KB |
Output is correct |
5 |
Correct |
41 ms |
10564 KB |
Output is correct |
6 |
Correct |
18 ms |
9916 KB |
Output is correct |
7 |
Correct |
21 ms |
10588 KB |
Output is correct |
8 |
Correct |
22 ms |
10564 KB |
Output is correct |
9 |
Incorrect |
21 ms |
10268 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
7772 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |