제출 #283565

#제출 시각아이디문제언어결과실행 시간메모리
283565tinjyu삶의 질 (IOI10_quality)C++14
0 / 100
1 ms640 KiB
#include "quality.h" #include <iostream> using namespace std; long long int h,w,r,c,sum[3005][3005],a[3005][3005]; bool check(){ for(int i=0;i<r;i++) { for(int j=0;j<c;j++) { sum[i][j]=a[i][j]; if(i>0)sum[i][j]+=sum[i-1][j]; if(j>0)sum[i][j]+=sum[i][j-1]; if(i>0 && j>0)sum[i][j]-=sum[i-1][j-1]; //cout<<sum[i][j]<<" "; } //cout<<endl; } for(int i=h-1;i<r;i++) { for(int j=w-1;j<c;j++) { int now=sum[i][j]; if(i-h>=0)now-=sum[i-h][j]; if(j-w>=0)now-=sum[i][j-w]; if(i-h>=0 && j-w>=0)now+=sum[i-h][j-w]; //cout<<i<<" "<<j<<" "<<now<<endl; if(now<=0)return 1; } } return 0; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { long long int ans,le=1,ri=R*C; h=H; w=W; r=R; c=C; while(le<=ri) { int mid=(le+ri)/2; cout<<mid<<endl; for(int i=0;i<R;i++) { for(int j=0;j<C;j++) { if(Q[i][j]<mid)a[i][j]=-1; if(Q[i][j]==mid)a[i][j]=0; if(Q[i][j]>mid)a[i][j]=1; //cout<<a[i][j]<<" "; } //cout<<endl; } if(check()==1) { ans=mid; ri=mid-1; } else le=mid+1; } return ans; }

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

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:63:9: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   63 |  return ans;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...