Submission #1055609

# Submission time Handle Problem Language Result Execution time Memory
1055609 2024-08-12T23:48:06 Z vjudge1 Catfish Farm (IOI22_fish) C++17
0 / 100
26 ms 9536 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll fishies[302][302];
ll dp[302][2][302];
inline ll ones(int col,int len){
    return fishies[col][len];
}
ll max_weights(int N,int M,vector<int> X,vector<int> Y,vector<int> W) {
    for(int i=0;i<M;i++)
        fishies[X[i]+1][Y[i]+1]=W[i];
    for(int i=1;i<=N;i++)
        for(int j=1;j<=N+1;j++)
            fishies[i][j]+=fishies[i][j-1];
    for(int i=1;i<=N+1;i++)
        dp[1][1][i-1]=ones(2,i-1);
    for(int i=2;i<=N+1;i++){
        for(int rw=1;rw<=N+1;rw++) {
            ll K=0;
            for(int rw2=0;rw2<=N;rw2++)
                K=max(K,dp[i-2][0][rw2]+ones(i+1,rw-1)+
                max(0ll,ones(i-1,rw-1)-ones(i-1,rw2)));
            for(int rw2=0;rw2<=N;rw2++) 
                K=max(K,dp[i-2][0][rw2]+ones(i+1,rw-1)+
                max(0ll,ones(i-1,rw-1)-ones(i-1,rw2)));
            dp[i][1][rw-1]=K;
        }
        for(int rw=0;rw<=N;rw++) {
            for(int rw2=1;rw2<=N+1;rw2++){
                if(rw2-1>rw) break;
                ll K=ones(i+1,rw2-1)-ones(i,rw2-1)+dp[i-1][0][rw];
                dp[i][0][rw2-1]=max(dp[i][0][rw2-1],K);
            }
        }
        for(int rw=0;rw<=N;rw++){
            for(int rw2=1;rw2<=N+1;rw2++){
                ll K=ones(i+1,rw2-1)-ones(i,min(rw,rw2-1))+
                ones(i-1,rw2-1)-ones(i-1,min(rw2-1,rw))+dp[i-1][1][rw];
                dp[i][rw2>rw][rw2-1]=max(dp[i][rw2>rw][rw2-1],K);
            }
        }
    }
    ll ans=0;
    for(int i=0;i<=N;i++)
        ans=max({ans,dp[N][0][i],dp[N][1][i]});
    return ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 5724 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 26 ms 9536 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1880 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 13 ms 1372 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 13 ms 1372 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 13 ms 1372 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1880 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 5724 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -