제출 #80755

#제출 시각아이디문제언어결과실행 시간메모리
80755farukkastamonudaThe Kingdom of JOIOI (JOI17_joioi)C++14
60 / 100
1490 ms263168 KiB
#include <bits/stdc++.h> #define fi first #define se second #define lo long long #define inf 1000000000 #define md 1000000007 #define li 2005 #define mp make_pair #define pb push_back using namespace std; int n,m,A[li][li],mn=md,mx; bool check(int val){ int mxj=1; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(A[i][j]<mx-val) mxj=max(mxj,j+1); } for(int j=1;j<=m;j++){ if(mn+val<A[i][j] && j<mxj) return false; } } return true; } int solve(){ int bas=0,son=mx-mn; while(bas<=son){ //cout<<"debig->:: "<<bas<<' '<<son<<endl; int mid=(bas+son)/2; if(check(mid)) son=mid-1; else bas=mid+1; } return bas; } void flip_row(){ for(int i=1;i<=n/2;i++){ for(int j=1;j<=m;j++){ swap(A[i][j],A[n-i+1][j]); } } } void flip_col(){ for(int i=1;i<=n;i++){ for(int j=1;j<=m/2;j++){ swap(A[i][j],A[i][m-j+1]); } } } int main(){ scanf("%d %d",&n,&m); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ scanf("%d",&A[i][j]); mx=max(mx,A[i][j]); mn=min(mn,A[i][j]); } } int ty=solve(); //printf("%d\n",ty); flip_row(); ty=min(ty,solve()); flip_col(); ty=min(ty,solve()); flip_row(); ty=min(ty,solve()); printf("%d\n",ty); return 0; }

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

joioi.cpp: In function 'int main()':
joioi.cpp:49:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
joioi.cpp:52:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&A[i][j]);
    ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...