#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a[3001][3001] , b[3001][3001] , d[3001][3001];
int n , m;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
std::vector<int> W) {
n = N; m = M;
for (int i = 0; i < m; i++) {
d[Y[i] + 1][X[i] + 1] = W[i];
}
for (int j = 1; j <= n; j++) {
if (j != n) {
a[1][j] = b[1][j - 1] + d[1][j];
for (int i = 2; i <= n; i++) {
a[i][j] = max(a[i - 1][j] , a[i - 1][j - 1]) + d[i][j];
}
}
if (j == 1) continue;
b[n][j] = a[n][j - 2] + d[n][j];
for (int i = n - 1; i > 0; i--) {
b[i][j] = max(b[i + 1][j] , b[i + 1][j - 1]) + d[i][j];
}
}
ll ans = max(a[n][n - 1] , b[1][n]);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
26 ms |
4220 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Runtime error |
49 ms |
8112 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
44 ms |
25088 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Incorrect |
1 ms |
1876 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '214714912058' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Incorrect |
1 ms |
1876 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '214714912058' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Incorrect |
1 ms |
1876 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '214714912058' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
44 ms |
25088 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
26 ms |
4220 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |