# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
766892 | 2023-06-26T08:37:58 Z | irmuun | 삶의 질 (IOI10_quality) | C++17 | 0 ms | 0 KB |
#include<bits/stdc++.h> #include "quality.h" using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(s) s.begin(),s.end() int rectangle(int R,int C,int H,int W,int Q[3000][3000]){ int sum[R+1][C+1],m=H*W/2+1; int l=1,r=R*C; while(l<r){ int mid=(l+r)/2; bool ok=false; sum[0][0]=0; for(int i=0;i<=R;i++){ for(int j=0;j<=C;j++){ if(i==0||j==0){ sum[i][j]=0; continue; } sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+(Q[i-1][j-1]<=mid); if(i>=H&&j>=W){ if(sum[i][j]-sum[i-H][j]-sum[i][j-W]+sum[i-H][j-W]>=m){ ok=true; } } } } if(ok==true){ r=mid; } else{ l=mid+1; } } return l; }