#include "fish.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=3e3+5;
ll dp[nx][nx][2], qs[nx][nx], mx;
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++) qs[X[i]+1][Y[i]+1]=W[i];
for (int i=1; i<=N; i++) for (int j=1; j<=N; j++) qs[i][j]+=qs[i][j-1];
for (int i=1; i<=N; i++)
{
for (int j=1; j<=N; j++)
{
for (int k=0; k<=j; k++) dp[i][j][0]=max(dp[i][j][0], dp[i-1][k][0]+qs[i+1][j]+qs[i-1][j]-qs[i-1][k]-qs[i][k]);
for (int k=j; k<=N; k++) dp[i][j][1]=max(dp[i][j][1], max(dp[i-1][k][1], dp[i-1][k][0])+qs[i+1][j]-qs[i][j]);
if (i>=2) for (int k=0; k<=N; k++) dp[i][j][0]=max(dp[i][j][0], max(dp[i-2][k][0], dp[i-2][k][1])+qs[i+1][j]);
//cout<<i<<' '<<j<<' '<<dp[i][j][0]<<' '<<dp[i][j][1]<<'\n';
mx=max({mx, dp[i][j][0], dp[i][j][1]});
}
}
return mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1056 ms |
123992 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Execution timed out |
1047 ms |
121928 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1081 ms |
115168 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Incorrect |
9 ms |
2004 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '194343694717' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Incorrect |
9 ms |
2004 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '194343694717' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Incorrect |
9 ms |
2004 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '194343694717' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1081 ms |
115168 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1056 ms |
123992 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |