#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#define rall(s) s.rbegin(), s.rend()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define s second
#define f first
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int N = 1e5 + 5;
const ll inf = 1e18;
ll c[N][10], dp[N][10][10];
long long max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) {
int z = 0;
for (int i = 0; i < m; i++) {
c[x[i] + 1][y[i] + 1] = w[i];
z = max(z, y[i] + 2);
}
for (int j = 0; j < z; j++) {
for (int k = 0; k < z; k++) {
dp[0][j][k] = (k ? -inf : 0);
}
}
for (int i = 1; i <= n; i++) {
for (int j = 0; j < z; j++) {
for (int k = 0; k < z; k++) {
for (int s = 0; s < z; s++) {
ll sum = 0;
for (int x = k + 1; x <= max(j, s); x++) {
sum += c[i][x];
}
dp[i][j][k] = max(dp[i][j][k], dp[i - 1][k][s] + sum);
}
}
}
}
ll ans = 0;
for (int i = 0; i < z; i++) {
ans = max(ans, dp[n][0][i]);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1041 ms |
4944 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Execution timed out |
1078 ms |
7212 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
78676 KB |
Output is correct |
2 |
Correct |
36 ms |
78676 KB |
Output is correct |
3 |
Correct |
45 ms |
77904 KB |
Output is correct |
4 |
Correct |
56 ms |
84868 KB |
Output is correct |
5 |
Correct |
60 ms |
90448 KB |
Output is correct |
6 |
Correct |
56 ms |
89688 KB |
Output is correct |
7 |
Correct |
60 ms |
90252 KB |
Output is correct |
8 |
Correct |
55 ms |
90448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Execution timed out |
1024 ms |
348 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
600 KB |
Output is correct |
15 |
Execution timed out |
1024 ms |
348 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
78676 KB |
Output is correct |
2 |
Correct |
36 ms |
78676 KB |
Output is correct |
3 |
Correct |
45 ms |
77904 KB |
Output is correct |
4 |
Correct |
56 ms |
84868 KB |
Output is correct |
5 |
Correct |
60 ms |
90448 KB |
Output is correct |
6 |
Correct |
56 ms |
89688 KB |
Output is correct |
7 |
Correct |
60 ms |
90252 KB |
Output is correct |
8 |
Correct |
55 ms |
90448 KB |
Output is correct |
9 |
Runtime error |
18 ms |
6856 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1041 ms |
4944 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |