#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
long long int max_weights(int N,int M,vector<int> x,vector<int> y,vector<int> w){
long long int dp[4]={0,0,0,0};
long long int tmp[4];
int Graph[N]={0};
for(int i=0;i<M;i++){
Graph[x[i]]=w[i];
}
dp[2]=Graph[0];
for(int i=1;i<N-1;i++){
tmp[0]=max(dp[0],dp[2]);
tmp[1]=max(dp[0],dp[2]);
tmp[2]=max(dp[1],dp[3])+Graph[i];
tmp[3]=max(dp[1]+Graph[i],dp[3]);
dp[0]=tmp[0];
dp[1]=tmp[1];
dp[2]=tmp[2];
dp[3]=tmp[3];
//cout<<dp[0]<<" "<<dp[1]<<" "<<dp[2]<<" "<<dp[3]<<endl;
}
dp[1]+=Graph[N-1];
return max(max(dp[0],dp[1]),max(dp[2],dp[3]));
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
2884 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
276 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
14 ms |
2192 KB |
Output is correct |
4 |
Correct |
11 ms |
2136 KB |
Output is correct |
5 |
Correct |
31 ms |
4044 KB |
Output is correct |
6 |
Correct |
24 ms |
3516 KB |
Output is correct |
7 |
Correct |
26 ms |
3528 KB |
Output is correct |
8 |
Correct |
27 ms |
3496 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
14 ms |
2192 KB |
Output is correct |
4 |
Correct |
11 ms |
2136 KB |
Output is correct |
5 |
Correct |
31 ms |
4044 KB |
Output is correct |
6 |
Correct |
24 ms |
3516 KB |
Output is correct |
7 |
Correct |
26 ms |
3528 KB |
Output is correct |
8 |
Correct |
27 ms |
3496 KB |
Output is correct |
9 |
Incorrect |
26 ms |
3528 KB |
1st lines differ - on the 1st token, expected: '99999', found: '66666' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
2884 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453' |
2 |
Halted |
0 ms |
0 KB |
- |