#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++){
ll prev=0;
for(int l=0;l<h;l++)
prev=max(prev,dp[i-1][l][j][k]);
for(int l=0;l<h;l++){
dp[i][j][k][l]+=prev;
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1197 ms |
1848056 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
920 ms |
2097152 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
8020 KB |
Output is correct |
2 |
Correct |
11 ms |
8052 KB |
Output is correct |
3 |
Correct |
22 ms |
8496 KB |
Output is correct |
4 |
Correct |
20 ms |
9552 KB |
Output is correct |
5 |
Correct |
38 ms |
12092 KB |
Output is correct |
6 |
Correct |
31 ms |
11344 KB |
Output is correct |
7 |
Correct |
34 ms |
11956 KB |
Output is correct |
8 |
Correct |
36 ms |
11948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
216 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
440 KB |
Output is correct |
10 |
Correct |
3 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
1108 KB |
Output is correct |
12 |
Correct |
2 ms |
1980 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
216 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
440 KB |
Output is correct |
10 |
Correct |
3 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
1108 KB |
Output is correct |
12 |
Correct |
2 ms |
1980 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
1108 KB |
Output is correct |
15 |
Runtime error |
872 ms |
2097152 KB |
Execution killed with signal 9 |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
216 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
440 KB |
Output is correct |
10 |
Correct |
3 ms |
2004 KB |
Output is correct |
11 |
Correct |
1 ms |
1108 KB |
Output is correct |
12 |
Correct |
2 ms |
1980 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
1108 KB |
Output is correct |
15 |
Runtime error |
872 ms |
2097152 KB |
Execution killed with signal 9 |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
8020 KB |
Output is correct |
2 |
Correct |
11 ms |
8052 KB |
Output is correct |
3 |
Correct |
22 ms |
8496 KB |
Output is correct |
4 |
Correct |
20 ms |
9552 KB |
Output is correct |
5 |
Correct |
38 ms |
12092 KB |
Output is correct |
6 |
Correct |
31 ms |
11344 KB |
Output is correct |
7 |
Correct |
34 ms |
11956 KB |
Output is correct |
8 |
Correct |
36 ms |
11948 KB |
Output is correct |
9 |
Runtime error |
848 ms |
2097152 KB |
Execution killed with signal 9 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1197 ms |
1848056 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |