#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
vector<vector<long long>> vp(N, vector<long long>(N + 2));
for (int i = 0; i < N; i++)
vp[i].assign(N + 2, 0);
for (int i = 0; i < M; i++)
vp[X[i]][Y[i] + 1] += W[i];
for (int i = 0; i < N; i++)
for (int j = 1; j <= N; j++)
vp[i][j] += vp[i][j - 1];
long long dp[N][N+2][N+2];
memset(dp,0,sizeof(dp));
for (int i = 0; i <= min(N,10); i++) {
for (int j = 0; j <= min(N,10); j++) {
dp[0][i][j] = max(dp[0][i][j],vp[0][j] - vp[0][i]);
}
}
for (int i = 1; i < N; i++) {
for (int j = 0; j <=min(N,10); j++) {
for (int g = 0; g <= min(N,10); g++) {
for (int e = 0; e <=min(N,10); e++) {
dp[i][j][g]=max(dp[i][j][g],dp[i-1][e][j]+max(max(vp[i][e]-vp[i][j],0LL),max(vp[i][g]-vp[i][j],0LL)));
}
}
}
}
long long ans=0;
for(int i=0;i<=min(N,10);i++){
ans=max(ans,dp[N-1][i][0]);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1113 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
360 KB |
Output is correct |
2 |
Runtime error |
945 ms |
2097152 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
881 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
352 KB |
Output is correct |
7 |
Correct |
0 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
356 KB |
Output is correct |
9 |
Correct |
17 ms |
27744 KB |
Output is correct |
10 |
Correct |
117 ms |
215128 KB |
Output is correct |
11 |
Correct |
16 ms |
27680 KB |
Output is correct |
12 |
Correct |
122 ms |
215104 KB |
Output is correct |
13 |
Correct |
3 ms |
3936 KB |
Output is correct |
14 |
Correct |
134 ms |
215168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
352 KB |
Output is correct |
7 |
Correct |
0 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
356 KB |
Output is correct |
9 |
Correct |
17 ms |
27744 KB |
Output is correct |
10 |
Correct |
117 ms |
215128 KB |
Output is correct |
11 |
Correct |
16 ms |
27680 KB |
Output is correct |
12 |
Correct |
122 ms |
215104 KB |
Output is correct |
13 |
Correct |
3 ms |
3936 KB |
Output is correct |
14 |
Correct |
134 ms |
215168 KB |
Output is correct |
15 |
Incorrect |
116 ms |
215136 KB |
1st lines differ - on the 1st token, expected: '299', found: '10' |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
352 KB |
Output is correct |
7 |
Correct |
0 ms |
356 KB |
Output is correct |
8 |
Correct |
0 ms |
356 KB |
Output is correct |
9 |
Correct |
17 ms |
27744 KB |
Output is correct |
10 |
Correct |
117 ms |
215128 KB |
Output is correct |
11 |
Correct |
16 ms |
27680 KB |
Output is correct |
12 |
Correct |
122 ms |
215104 KB |
Output is correct |
13 |
Correct |
3 ms |
3936 KB |
Output is correct |
14 |
Correct |
134 ms |
215168 KB |
Output is correct |
15 |
Incorrect |
116 ms |
215136 KB |
1st lines differ - on the 1st token, expected: '299', found: '10' |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
881 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1113 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |