Submission #657638

# Submission time Handle Problem Language Result Execution time Memory
657638 2022-11-10T15:05:31 Z coding_snorlax Catfish Farm (IOI22_fish) C++17
0 / 100
53 ms 10080 KB
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
int Graph[302][10]={{0}};
long long int dp[10][10]={{0}};
long long int tmp[10][10]={{0}};
long long int Count(int n,int m,int column){
    long long int answer=0;
    for(int i=n;i<=m;i++){
        answer+=Graph[column][i];
    }
    return answer;
}
void check(){
    cout<<endl;
    for(int i=0;i<9;i++){
        for(int j=0;j<9;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }
}
long long int max_weights(int N,int M,vector<int> x,vector<int> y,vector<int> w){
    for(int i=0;i<M;i++){
        Graph[x[i]][y[i]]=w[i];
    }
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            dp[i][j]=Count(i,j,0);
        }
    }
    //check();
    for(int Time=1;Time<N-1;Time++){
        for(int j=0;j<10;j++){
            for(int k=0;k<10;k++){
                for(int i=0;i<10;i++){
                    tmp[j][k]=max(tmp[j][k],dp[i][j]+Count(j,max(k,i),Time));
                }
            }
        }
        for(int j=0;j<10;j++){
            for(int k=0;k<10;k++){
                dp[j][k]=tmp[j][k];
                tmp[j][k]=0;
            }
        }
        //check();
    }
    long long int Final=0;
    for(int j=0;j<10;j++){
        for(int k=0;k<10;k++){
            dp[j][k]+=Count(j,k,N-1);
            Final=max(Final,dp[j][k]);
        }
    }
    //check();
    return Final;
}
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 5580 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 53 ms 10080 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 440 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 440 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 5580 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -