제출 #923309

#제출 시각아이디문제언어결과실행 시간메모리
923309vjudge1Maxcomp (info1cup18_maxcomp)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #define int long long using namespace std; string yn(bool ans,string y="YES",string n="NO"){ return (ans?y:n); } #define all(a) a.begin(),a.end() void gogo(){ int n,m; cin>>n>>m; int a[n][m]; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>a[i][j]; } } int ans=-INT_MAX; int mn[n+1][n+1]; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ mn[i][j]=a[i][j]-i-j; if(i>0){ mn[i][j]=min(mn[i][j],mn[i-1][j]); } if(j>0){ mn[i][j]=min(mn[i][j],mn[i][j-1]); } if(j and i){ mn[i][j]=min(mn[i][j],mn[i-1][j-1]); } } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ ans=max(ans,a[i][j]-i-j-mn[i][j]); a[i][j]=-a[i][j]; } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ mn[i][j]=a[i][j]-i-j; if(i>0){ mn[i][j]=min(mn[i][j],mn[i-1][j]); } if(j>0){ mn[i][j]=min(mn[i][j],mn[i][j-1]); } if(j and i){ mn[i][j]=min(mn[i][j],mn[i-1][j-1]); } } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ a[i][j]-=i+j; ans=max(ans,a[i][j]-mn[i][j]); } } cout<<ans-1<<endl; } main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t=1; // cin>>t; while(t--){ gogo(); } }

컴파일 시 표준 에러 (stderr) 메시지

maxcomp.cpp:61:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   61 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...