Submission #1069274

# Submission time Handle Problem Language Result Execution time Memory
1069274 2024-08-21T18:40:10 Z beaconmc Catfish Farm (IOI22_fish) C++17
14 / 100
156 ms 60308 KB
#include "fish.h"

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)



set<ll> fish[2005];

map<vector<ll>, ll> weights;

ll dp[10][10][305];


long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
    FOR(i,0,10){
        FOR(j,0,10){
            FOR(k,0,305){
                dp[i][j][k] = 0;
            }
        }
    }

    FOR(i,0,M){
        Y[i]++;
        fish[X[i]].insert(Y[i]);
        weights[{X[i], Y[i]}] = W[i];
    }

    FOR(k,0,N){
        FOR(i,0,10){
            FOR(j,0,10){
            
                ll temp = 0;
                FOR(height, 0, 10){
                    if (fish[k+1].count(height)) temp += weights[{k+1, height}];

                    if (fish[k].count(height) && j>=height) temp -= weights[{k, height}];

                    if (k>0 && fish[k-1].count(height) && i < height && j<height) temp += weights[{k-1, height}];

                    dp[j][height][k+1] = max(dp[j][height][k+1], dp[i][j][k] + temp);
                }
            }
        }
    }

    ll ans = 0;
    FOR(i,0,10){
        FOR(j,0,10){
            FOR(k,0,N+1){
                ans = max(ans, dp[i][j][k]);
                //if (dp[i][j][k]==10) cout << i << " " << j << " " << k << endl;
            }
        }
    }
    return ans;





}
# Verdict Execution time Memory Grader output
1 Runtime error 70 ms 30544 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Runtime error 156 ms 60308 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1368 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 5 ms 860 KB Output is correct
10 Correct 21 ms 1116 KB Output is correct
11 Correct 7 ms 736 KB Output is correct
12 Correct 12 ms 856 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 10 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 5 ms 860 KB Output is correct
10 Correct 21 ms 1116 KB Output is correct
11 Correct 7 ms 736 KB Output is correct
12 Correct 12 ms 856 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 10 ms 860 KB Output is correct
15 Incorrect 2 ms 604 KB 1st lines differ - on the 1st token, expected: '299', found: '9'
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 5 ms 860 KB Output is correct
10 Correct 21 ms 1116 KB Output is correct
11 Correct 7 ms 736 KB Output is correct
12 Correct 12 ms 856 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 10 ms 860 KB Output is correct
15 Incorrect 2 ms 604 KB 1st lines differ - on the 1st token, expected: '299', found: '9'
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1368 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 70 ms 30544 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -