# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1082367 |
2024-08-31T08:25:24 Z |
jer033 |
Catfish Farm (IOI22_fish) |
C++17 |
|
837 ms |
2097152 KB |
#include "fish.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
using ll = long long;
const ll NINF = -5'000'000'000'000'000;
ll dp[450][15][15][15];
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
vector<vector<ll>> fish(N, vector<ll> (N, 0));
//we can consider empty cells to have catfish worth 0
for (int i=0; i<M; i++)
fish[X[i]][Y[i]] = W[i];
ll ans = 0;
int limit = min(8, N);
for (int r = 0; r < N; r++)
{
for (int i=0; i<=limit; i++)
for (int j=0; j<=limit; j++)
for (int k=0; k<=limit; k++)
{
ll history;
ll current;
history = 0;
if (r!=0)
{
for (int guess = 0; guess<=limit; guess++)
history = max(history, dp[r-1][guess][i][j]);
}
if ((r==0) and (i!=0))
current = NINF;
else if ((r==(N-1)) and (k!=0))
current = NINF;
else
{
current = 0;
int reach = max(i, k);
int start = j;
for (int fishy = start+1; fishy<=reach; fishy++)
current += fish[r][fishy];
}
dp[r][i][j][k] = history+current;
ans = max(ans, history+current);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
837 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '2', found: '58898' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
826 ms |
2097152 KB |
Execution killed with signal 9 |
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 |
Runtime error |
826 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
837 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |