(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 #688459

#TimeUsernameProblemLanguageResultExecution timeMemory
688459KhizriQuality Of Living (IOI10_quality)C++17
100 / 100
1503 ms175380 KiB
#include "quality.h" #include <bits/stdc++.h> using namespace std; const int mxn=3e3+5; int arr[mxn][mxn],dp[mxn][mxn]; int query(int i,int j,int x,int y){ return dp[i][j]-dp[i-x][j]-dp[i][j-y]+dp[i-x][j-y]; } int rectangle(int n, int m, int x, int y, int Q[3001][3001]) { for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ arr[i][j]=Q[i-1][j-1]; } } int l=1,r=n*m; while(l<=r){ int mm=(l+r)/2; int ans=0; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(arr[i][j]<=mm){ dp[i][j]=1; } else if(arr[i][j]>mm){ dp[i][j]=0; } dp[i][j]+=dp[i-1][j]; dp[i][j]+=dp[i][j-1]; dp[i][j]-=dp[i-1][j-1]; if(i>=x&&j>=y){ if(query(i,j,x,y)>=(x*y+1)/2){ ans=1; } } } } if(ans){ r=mm-1; } else{ l=mm+1; } } return r+1; }
#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...