# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
625713 |
2022-08-10T17:24:26 Z |
d4xn |
Catfish Farm (IOI22_fish) |
C++17 |
|
1000 ms |
53148 KB |
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ll long long
#define vi vector<int>
#define ii pair<int, int>
#define vii vector<ii>
const int N = 1e5+5, inf = INT_MAX;
int n, m;
int c[10][N];
bitset<N> vis[10][10];
ll dp[10][10][N]; // dp[i][j][k] = maximos peces que puedo conseguir
// con las k primeras columnas donde
// en la columna k+1 he subido i-1
// en la columna k+2 he subido j-1
ll mx(int curr, int h1, int h2) {
if (curr == -1) return 0;
if (vis[h1][h2][curr]) return dp[h1][h2][curr];
dp[h1][h2][curr] = 0;
vis[h1][h2][curr] = 1;
for (int h = 0; h < min(10, n+1); h++) {
ll cnt = 0;
// ver si pillo los de la derecha
if (curr+1 < n) {
for (int i = 0; i < h; i++) {
if (h2-1 < i && h1-1 < i) cnt += c[i][curr+1];
}
}
// ver si pillo los de la izquierda
if (curr-1 >= 0) {
for (int i = 0; i < h; i++) {
cnt += c[i][curr-1];
}
}
// ver si he eliminado alguno de los que he pillado
for (int i = 0; i < min(h, h1); i++) {
cnt -= c[i][curr];
}
dp[h1][h2][curr] = max(dp[h1][h2][curr], cnt + mx(curr-1, h, h1));
}
return dp[h1][h2][curr];
}
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
std::vector<int> W) {
for (int i = 0; i < 10; i++) {
memset(c[i], 0, sizeof(c[i]));
}
n = N;
m = M;
for (int i = 0; i < m; i++) {
c[Y[i]][X[i]] = W[i];
}
return mx(n-1, 0, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
38 ms |
12084 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4308 KB |
Output is correct |
2 |
Runtime error |
56 ms |
16036 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
53148 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4436 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
4180 KB |
Output is correct |
4 |
Correct |
3 ms |
4180 KB |
Output is correct |
5 |
Correct |
2 ms |
4180 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4308 KB |
Output is correct |
8 |
Correct |
2 ms |
4308 KB |
Output is correct |
9 |
Correct |
6 ms |
5204 KB |
Output is correct |
10 |
Correct |
9 ms |
5460 KB |
Output is correct |
11 |
Correct |
6 ms |
5204 KB |
Output is correct |
12 |
Correct |
9 ms |
5460 KB |
Output is correct |
13 |
Correct |
4 ms |
5204 KB |
Output is correct |
14 |
Correct |
10 ms |
5380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4436 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
4180 KB |
Output is correct |
4 |
Correct |
3 ms |
4180 KB |
Output is correct |
5 |
Correct |
2 ms |
4180 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4308 KB |
Output is correct |
8 |
Correct |
2 ms |
4308 KB |
Output is correct |
9 |
Correct |
6 ms |
5204 KB |
Output is correct |
10 |
Correct |
9 ms |
5460 KB |
Output is correct |
11 |
Correct |
6 ms |
5204 KB |
Output is correct |
12 |
Correct |
9 ms |
5460 KB |
Output is correct |
13 |
Correct |
4 ms |
5204 KB |
Output is correct |
14 |
Correct |
10 ms |
5380 KB |
Output is correct |
15 |
Runtime error |
9 ms |
8288 KB |
Execution killed with signal 11 |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4436 KB |
Output is correct |
2 |
Correct |
2 ms |
4948 KB |
Output is correct |
3 |
Correct |
2 ms |
4180 KB |
Output is correct |
4 |
Correct |
3 ms |
4180 KB |
Output is correct |
5 |
Correct |
2 ms |
4180 KB |
Output is correct |
6 |
Correct |
2 ms |
4180 KB |
Output is correct |
7 |
Correct |
2 ms |
4308 KB |
Output is correct |
8 |
Correct |
2 ms |
4308 KB |
Output is correct |
9 |
Correct |
6 ms |
5204 KB |
Output is correct |
10 |
Correct |
9 ms |
5460 KB |
Output is correct |
11 |
Correct |
6 ms |
5204 KB |
Output is correct |
12 |
Correct |
9 ms |
5460 KB |
Output is correct |
13 |
Correct |
4 ms |
5204 KB |
Output is correct |
14 |
Correct |
10 ms |
5380 KB |
Output is correct |
15 |
Runtime error |
9 ms |
8288 KB |
Execution killed with signal 11 |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
53148 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
38 ms |
12084 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |