#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN=1e5+2;
struct fish{fish(int xi,int yi,int wi):x(xi),y(yi),w(wi){} int x,y,w;};
ll max_weights(int N,int M,vector<int> X,vector<int> Y,vector<int> W) {
ll dp[MN][2][2],w[MN],ans=0;
for(int i=0;i<M;++i) w[X[i]+1]=W[i];
for(int i=1;i<=N;++i) {
dp[i][0][0]=max(dp[i-1][0][0],dp[i-1][1][0]);
dp[i][0][1]=max(dp[i-1][0][0],dp[i-1][1][0])+w[i+1];
dp[i][1][1]=max(dp[i-1][0][1],dp[i-1][1][1])-(i>1?w[i]:0)+w[i+1];
dp[i][1][0]=max(dp[i-1][0][1],dp[i-1][1][1]);
ans=max({ans,dp[i][0][0],dp[i][0][1],dp[i][1][1],dp[i][1][0]});
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
6988 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
4180 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4136 KB |
1st lines differ - on the 1st token, expected: '10082010', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
4180 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
4180 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
4180 KB |
1st lines differ - on the 1st token, expected: '3', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4136 KB |
1st lines differ - on the 1st token, expected: '10082010', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
6988 KB |
1st lines differ - on the 1st token, expected: '40313272768926', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |