답안 #169323

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169323 2019-12-19T18:08:22 Z Rouge_Hugo Maxcomp (info1cup18_maxcomp) C++14
15 / 100
9 ms 8316 KB
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
using namespace std;

int n,m;
const ll inf=1e11+10;
ll a[1009][1009];
ll b[1009][1009];
int main()
{
    fast;
    cin>>n>>m;
    for(int i=1;i<n+1;i++)
    {
        for(int j=1;j<m+1;j++)
        {
            cin>>a[i][j];
        }
    }
    ll re=0;
    for(int i=1;i<n+1;i++)
    {
        ll mx=0;
        for(int j=1;j<m+1;j++)
        {
            b[i][j]=max(b[i-1][j]-1,a[i][j]);
        }
        mx=b[i][1];
        for(int j=1;j<m+1;j++)
        {
            mx=max(mx,b[i][j]);
            re=max(re,mx-a[i][j]-1);
            mx--;
        }
    }
    memset(b,0,sizeof b);
    for(int j=1;j<m+1;j++)
        b[0][j]=inf;
    for(int i=1;i<n+1;i++)
    {
        ll mx=inf;
        for(int j=1;j<m+1;j++)
        {
            b[i][j]=min(b[i-1][j]+1,a[i][j]);
        }
        mx=b[i][1];

        for(int j=1;j<m+1;j++)
        {
            //cout<<mx<<" ";
            mx=min(mx,b[i][j]);
            re=max(re,a[i][j]-1-mx);
            mx++;
        }
    }
    cout<<re;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8312 KB Output is correct
2 Correct 8 ms 8312 KB Output is correct
3 Incorrect 8 ms 8312 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8312 KB Output is correct
2 Correct 8 ms 8312 KB Output is correct
3 Correct 9 ms 8316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8312 KB Output is correct
2 Correct 8 ms 8312 KB Output is correct
3 Incorrect 8 ms 8312 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8312 KB Output is correct
2 Correct 8 ms 8312 KB Output is correct
3 Incorrect 8 ms 8312 KB Output isn't correct
4 Halted 0 ms 0 KB -