#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll up[3010][3010];
ll down[3010][3010];
ll s[3010][3010];
ll 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++){
s[X[i]][Y[i]+1]+=W[i];
}
for(int i=0;i<N;i++)
for(int j=1;j<=N;j++)
s[i][j]+=s[i][j-1];
for(int i=1;i<N;i++){
for(int j=0;j<N;j++){
up[i][j]=down[i-1][0]-s[i-1][0]+s[i-1][j+1];
for(int k=0;k<=j;k++){
up[i][j]=max(up[i][j],up[i-1][k]-s[i-1][k]+s[i-1][j+1]);
down[i][j]=max(down[i][j],max(down[i-1][k],up[i-1][k])+s[i-1][k+1]-s[i-1][j]);
}
}
}
ll re=0;
for(int i=0;i<N;i++) re=max(re,max(up[N-1][i],down[N-1][i]));
return re;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1084 ms |
122184 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Execution timed out |
1077 ms |
120488 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1098 ms |
109868 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '2022' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '2022' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '4044', found: '2022' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1098 ms |
109868 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1084 ms |
122184 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |