#ifndef FISH_CPP_INCLUDED
#define FISH_CPP_INCLUDED
#include "fish.h"
#include <vector>
#include <cstring>
#include <cassert>
#include <iostream>
typedef long long ll;
long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y,
std::vector<int> w) {
n++;
ll 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];
}
}
ll dp[n + 1][n + 1];
memset(dp, 0, sizeof(dp));
for (int i = 2; i <= n; i++) {
for (int j = 0; j <= (i == n? 0 : 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
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1040 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1040 ms |
2097152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |