# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235989 | cfalas | Quality Of Living (IOI10_quality) | C++14 | 3658 ms | 120904 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "quality.h"
#include<bits/stdc++.h>
using namespace std;
#define MID (l+r)/2
int rectangle(int n, int m, int P, int q, int a[3001][3001]){
int l=0, r=n*m+1;
int mm;
while(l<=r){
int b[n][m] = {};
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(a[i][j]>MID) b[i][j] = 1;
else if(a[i][j]<MID) b[i][j]=-1;
}
}
int p[n+1][m+1] = {};
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
p[i][j] = p[i-1][j] + p[i][j-1] - p[i-1][j-1] + b[i-1][j-1];
}
}
bool poss = false;
for(int i=P;i<=n;i++){
for(int j=q;j<=m;j++){
if(p[i][j] - p[i-P][j] - p[i][j-q] + p[i-P][j-q] <= 0) poss = true;
}
}
if(poss) mm = MID, r = MID-1;
else l = MID+1;
}
return mm;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |