#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
long long sumtop[3003][3003], sumbot[3003][3003];
long long dp[3003][3003];
long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
for (long long i = 0; i < M; i++) {
sumtop[X[i]+1][Y[i]+1] += W[i];
sumbot[X[i]+1][Y[i]+1] += W[i];
}
for (long long i = 1; i <= N; i++) {
for (long long j = N; j >= 1; j--) sumtop[i][j] += sumtop[i][j+1];
for (long long j = 1; j <= N; j++) sumbot[i][j] += sumbot[i][j-1];
}
for (long long i = 1; i <= N; i++) {
for (long long j = 0; j <= N; j++) {
for (long long k = 0; k <= N; k++) {
dp[i][j] = max(
dp[i][j],
dp[i-1][k] - sumbot[i][min(j, k)] + sumbot[i+1][k] + (k > j ? sumbot[i-1][k] - sumbot[i-1][j] : 0)
);
}
}
}
long long mx = 0;
for (long long j = 0; j <= N; j++) {
mx = max(mx, dp[N][j]);
}
return mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1104 ms |
134224 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Execution timed out |
1094 ms |
131620 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1037 ms |
115140 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4444 KB |
1st lines differ - on the 1st token, expected: '8866', found: '16621' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4444 KB |
1st lines differ - on the 1st token, expected: '8866', found: '16621' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Incorrect |
1 ms |
4444 KB |
1st lines differ - on the 1st token, expected: '8866', found: '16621' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1037 ms |
115140 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1104 ms |
134224 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |