Submission #829320

# Submission time Handle Problem Language Result Execution time Memory
829320 2023-08-18T09:15:19 Z khoquennguoiminhthuong Maxcomp (info1cup18_maxcomp) C++14
0 / 100
1 ms 724 KB
#include <bits/stdc++.h>

using namespace std;
int m,n;
int a[1005][1005];
int b[1005][1005];
int minn[1005][100];
int ans=-1e9;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>m>>n;
    for(int i=1; i<=m; i++)
        for(int j=1; j<=n; j++)
            cin>>a[i][j];
    for(int i=1; i<=m; i++)
        for(int j=1; j<=n; j++)
            b[i][j]=a[i][j]-i-j;
    minn[0][0]=1e9;
    for(int i=1; i<=m; i++)
        for(int j=1; j<=n; j++) {
            minn[i][j]=min({minn[i-1][j],minn[i][j-1],b[i][j]});
            ans=max(ans,a[i][j]-i-j-minn[i][j]-1);
        }
    memset(minn,0x3f,sizeof(minn));
    for(int i=1; i<=m; i++)
        for(int j=1; j<=n; j++)
            b[i][j]=a[i][j]-i+j;
    for(int i=1; i<=m; i++)
        for(int j=n; j>=1; j--) {
            minn[i][j]=min({minn[i-1][j],minn[i][j+1],b[i][j]});
            ans=max(ans,a[i][j]-i+j-minn[i][j]-1);
        }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Incorrect 1 ms 724 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Incorrect 1 ms 724 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Incorrect 1 ms 724 KB Output isn't correct
4 Halted 0 ms 0 KB -