#include "fish.h"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w){
int h=0;
for(int i=0;i<m;i++) h=max(h,y[i]);
h+=2;
ll fish[n][h]={};
for(int i=0;i<m;i++) fish[x[i]][y[i]+1]=w[i];
for(int i=0;i<n;i++)
for(int j=1;j<h;j++)
fish[i][j]+=fish[i][j-1];
ll dp[n][h][h][h]={};
for(int i=1;i<n;i++){
for(int j=0;j<h;j++){
for(int k=0;k<h;k++){
for(int l=0;l<h;l++)
dp[i][j][k][l]=max(dp[i][j][k][l],dp[i-1][l][j][k]);
for(int l=0;l<h;l++){
if(k>=l) dp[i][j][k][l]+=fish[i][k]-fish[i][l];
else dp[i][j][k][l]+=fish[i-1][max(j,l)]-fish[i-1][max(j,k)];
}
}
}
}
ll res=0;
for(int i=0;i<h;i++)
for(int j=0;j<h;j++)
for(int k=0;k<h;k++)
res=max(res,dp[n-1][i][j][k]);
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
846 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
8128 KB |
Output is correct |
2 |
Correct |
13 ms |
8024 KB |
Output is correct |
3 |
Incorrect |
31 ms |
9500 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '17841087041964' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
8128 KB |
Output is correct |
2 |
Correct |
13 ms |
8024 KB |
Output is correct |
3 |
Incorrect |
31 ms |
9500 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '17841087041964' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
846 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |