(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #332098

#TimeUsernameProblemLanguageResultExecution timeMemory
332098Sho10Quality Of Living (IOI10_quality)C++14
100 / 100
2546 ms113132 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #include "quality.h" #define ll long long #define double long double #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define f first #define s second #define pb push_back #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000007 #define PI 3.14159265359 #define MAXN 100005 #define INF 1000000005 #define LINF 1000000000000000005ll #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; int a[3005][3005],pref[3005][3005],n,m,h,w; int sum(int x2,int y2){ int x1=x2-h+1; int y1=y2-w+1; return pref[x2][y2]-pref[x2][y1-1]-pref[x1-1][y2]+pref[x1-1][y1-1]; } int check(int x){ for(int i=1;i<=n;i++) { int nr=0; for(int j=1;j<=m;j++) { if(a[i][j]<=x){ nr++; } pref[i][j]=pref[i-1][j]+nr; } } int mn=(h*w+1)/2; for(int i=h;i<=n;i++) { for(int j=w;j<=m;j++) { if(sum(i,j)>=mn){ return 1; } } } return 0; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { n=R; m=C; h=H; w=W; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { a[i][j]=Q[i-1][j-1]; } } int l=1,r=n*m; while(l<r){ int mid=(l+r)/2; if(check(mid)){ r=mid; }else l=mid+1; } return l; } /* int32_t main(){ CODE_START; */
#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...