#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][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[1][1][0]=a[0];
dp[1][0][1]=a[1];
for(int i=2;i<N;i++){
dp[i][1][1]=max(dp[i-1][1][0],dp[i-1][1][1]);
dp[i][1][0]=max(dp[i-1][0][1],dp[i-1][0][0]+a[i-1]);
dp[i][0][1]=max(dp[i-1][1][0],dp[i-1][1][1])+a[i];
dp[i][0][0]=max(dp[i-1][0][1],dp[i-1][0][0]);
}
return max({dp[N-1][0][0],dp[N-1][0][1],dp[N-1][1][0],dp[N-1][1][1]});
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
8540 KB |
Output is correct |
2 |
Correct |
14 ms |
9052 KB |
Output is correct |
3 |
Correct |
1 ms |
7000 KB |
Output is correct |
4 |
Correct |
1 ms |
6744 KB |
Output is correct |
5 |
Correct |
45 ms |
13700 KB |
Output is correct |
6 |
Correct |
57 ms |
13696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6748 KB |
Output is correct |
2 |
Correct |
1 ms |
6748 KB |
Output is correct |
3 |
Correct |
8 ms |
8028 KB |
Output is correct |
4 |
Correct |
7 ms |
8028 KB |
Output is correct |
5 |
Correct |
22 ms |
10684 KB |
Output is correct |
6 |
Correct |
12 ms |
10076 KB |
Output is correct |
7 |
Correct |
18 ms |
10452 KB |
Output is correct |
8 |
Correct |
15 ms |
10588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6748 KB |
Output is correct |
2 |
Correct |
1 ms |
6748 KB |
Output is correct |
3 |
Correct |
8 ms |
8028 KB |
Output is correct |
4 |
Correct |
7 ms |
8028 KB |
Output is correct |
5 |
Correct |
22 ms |
10684 KB |
Output is correct |
6 |
Correct |
12 ms |
10076 KB |
Output is correct |
7 |
Correct |
18 ms |
10452 KB |
Output is correct |
8 |
Correct |
15 ms |
10588 KB |
Output is correct |
9 |
Incorrect |
14 ms |
10320 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
8540 KB |
Output is correct |
2 |
Correct |
14 ms |
9052 KB |
Output is correct |
3 |
Correct |
1 ms |
7000 KB |
Output is correct |
4 |
Correct |
1 ms |
6744 KB |
Output is correct |
5 |
Correct |
45 ms |
13700 KB |
Output is correct |
6 |
Correct |
57 ms |
13696 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 |
- |