# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
634137 |
2022-08-23T21:21:05 Z |
Utaha |
Catfish Farm (IOI22_fish) |
C++17 |
|
23 ms |
4300 KB |
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
const int maxN = 100005;
const long long INF = 1e18;
// 0: fish exist
// 1: pier
// 2: claimed
long long dp[3][maxN];
long long val[maxN];
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
std::vector<int> W) {
for (auto x : Y) {
assert (x == 0);
}
assert (N <= 4);
for(int i = 0; i < M; i++) {
val[X[i] + 1] = W[i];
}
dp[0][0] = 0;
dp[1][0] = -INF;
for(int i = 1; i <= N; i++){
dp[0][i] = max({dp[2][i - 1], dp[0][i - 1]});
dp[1][i] = max({dp[1][i - 1] + val[i + 1] - val[i], dp[0][i - 1] + val[i - 1] + val[i + 1], dp[2][i - 1] + val[i + 1]});
dp[2][i] = dp[1][i - 1];
}
return max(dp[0][N + 1], dp[2][N + 1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
23 ms |
4300 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
23 ms |
4300 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |