Submission #1069278

# Submission time Handle Problem Language Result Execution time Memory
1069278 2024-08-21T18:42:35 Z beaconmc Catfish Farm (IOI22_fish) C++17
9 / 100
217 ms 102944 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--)

const ll maxn = 100005;


set<ll> fish[maxn];

map<vector<ll>, ll> weights;

ll dp[10][10][maxn];


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,maxn){
                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,2){
            FOR(j,0,2){
            
                ll temp = 0;
                FOR(height, 0, 2){
                    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]);

            }
        }
    }
    return ans;





}
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 99212 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '223762357'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 83276 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 83288 KB Output is correct
2 Correct 45 ms 83536 KB Output is correct
3 Correct 115 ms 93748 KB Output is correct
4 Correct 88 ms 90452 KB Output is correct
5 Correct 177 ms 102848 KB Output is correct
6 Correct 217 ms 102268 KB Output is correct
7 Correct 184 ms 102944 KB Output is correct
8 Correct 190 ms 102940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 83296 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 83296 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 83296 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 83288 KB Output is correct
2 Correct 45 ms 83536 KB Output is correct
3 Correct 115 ms 93748 KB Output is correct
4 Correct 88 ms 90452 KB Output is correct
5 Correct 177 ms 102848 KB Output is correct
6 Correct 217 ms 102268 KB Output is correct
7 Correct 184 ms 102944 KB Output is correct
8 Correct 190 ms 102940 KB Output is correct
9 Incorrect 133 ms 102620 KB 1st lines differ - on the 1st token, expected: '99999', found: '1'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 99212 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '223762357'
2 Halted 0 ms 0 KB -