Submission #906118

#TimeUsernameProblemLanguageResultExecution timeMemory
906118JakobZorzQuality Of Living (IOI10_quality)C++17
60 / 100
5012 ms31828 KiB
#include"quality.h" #include<iostream> using namespace std; int w2,h2,w,h; int mat[3000][3000]; bool check(int val){ for(int y=0;y<=h2-h;y++){ for(int x=0;x<=w2-w;x++){ int low=0; for(int x2=x;x2<x+w;x2++) for(int y2=y;y2<y+h;y2++) low+=(mat[x2][y2]<=val); if(low>=(w*h+1)/2){ //cout<<val<<" "<<low<<" "<<(w*h+1)/2<<" false\n"; return true; } } } //cout<<val<<" true\n"; return false; } int rectangle(int R,int C,int H,int W,int Q[3001][3001]){ w2=R; h2=C; w=H; h=W; for(int x=0;x<w2;x++) for(int y=0;y<h2;y++) mat[x][y]=Q[x][y]; int bl=0,br=w2*h2; while(bl<br-1){ int mid=(bl+br)/2; if(check(mid)) br=mid; else bl=mid; } return br; }
#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...