#ifndef FISH_CPP_INCLUDED
#define FISH_CPP_INCLUDED
#include "fish.h"
#include <vector>
#include <cstring>
long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y,
std::vector<int> w) {
n++;
int cnt[n + 1][n + 1];
memset(cnt, 0, sizeof(cnt));
for (int i = 0; i < m; i++) {
x[i]++, y[i]++;
x[i] = n - 1 - x[i] + 1;
cnt[x[i]][y[i]] += w[i];
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cnt[i][j] += cnt[i - 1][j];
}
}
int dp[n + 1][n + 1];
memset(dp, 0, sizeof(dp));
for (int i = 2; i <= n; i++) {
for (int j = 0; j <= n; j++) {
for (int k = 0; k <= (i == 2? 0 : n); k++) {
dp[i][j] = std::max(dp[i][j], dp[i - 2][k] + cnt[i - 1][std::max(j, k)]);
}
}
}
return dp[n][0];
return 0;
}
#endif // FISH_CPP_INCLUDED
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1155 ms |
2049260 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1038 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1038 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1155 ms |
2049260 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |