Submission #657549

# Submission time Handle Problem Language Result Execution time Memory
657549 2022-11-10T08:26:20 Z coding_snorlax Catfish Farm (IOI22_fish) C++17
0 / 100
24 ms 4208 KB
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
int Graph[302][10]={{0}};
long long int dp[9][9]={{0}};
long long int tmp[9][9];
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<9;i++){
        for(int j=0;j<9;j++){
            dp[i][j]=Count(i+1,j,0);
        }
    }
    //check();
    for(int i=1;i<N-1;i++){
        for(int j=0;j<9;j++){
            for(int k=0;k<9;k++){
                long long int tmp_num=0;
                for(int I=0;I<9;I++){
                    tmp[j][k]=max(tmp[j][k],dp[I][j]+Count(j+1,max(k,I),i));
                }
            }
        }
        for(int j=0;j<9;j++){
            for(int k=0;k<9;k++){
                long long int tmp_num=0;
                for(int I=0;I<9;I++){
                    dp[j][k]=tmp[j][k];
                }
            }
        }
        //check();
    }
    long long int Final=0;
    for(int j=0;j<9;j++){
        for(int k=0;k<9;k++){
            dp[j][k]+=Count(k+1,j,N-1);
            Final=max(Final,dp[j][k]);
        }
    }
    //check();
    return Final;
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:36:31: warning: unused variable 'tmp_num' [-Wunused-variable]
   36 |                 long long int tmp_num=0;
      |                               ^~~~~~~
fish.cpp:44:31: warning: unused variable 'tmp_num' [-Wunused-variable]
   44 |                 long long int tmp_num=0;
      |                               ^~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 24 ms 4208 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 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 Runtime error 3 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 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 212 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 212 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 3 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 24 ms 4208 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -