Submission #545235

# Submission time Handle Problem Language Result Execution time Memory
545235 2022-04-04T04:39:59 Z AbdelmagedNour Quality Of Living (IOI10_quality) C++17
0 / 100
5000 ms 468 KB
#include <stdio.h>
#include <stdlib.h>
#include "bits/stdc++.h"
using namespace std;
#include "quality.h"
//#include "grader.cpp"
int pre[3001][3001];
int rectangle(int R, int C, int H, int W, int Q[3001][3001]);
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
	int n=R,m=C,x=H,y=W;
	int l=1,r=n*m,res=INT_MAX;
	while(l<=r){
        int md=(l+1)>>1;
        bool flag=0;
        for(int i=0;i<n&&!flag;i++){
            for(int j=0;j<m&&!flag;j++){
                pre[i][j]=(i?pre[i-1][j]:0)+(j?pre[i][j-1]:0)-(i&&j?pre[i-1][j-1]:0)+(Q[i][j]<=md?1:-1);
                if(i>=x-1&&j>=y-1){
                    int sum1=pre[i][j];
                    int sum2=(j-y+1?pre[i][j-y]:0);
                    int sum3=(i-x+1?pre[i-x][j]:0);
                    int sum4=(i-x+1&&j-y+1?pre[i-x][j-y]:0);
                    if((sum1-sum2-sum3+sum4)<1)continue;
                    flag=1;
                    break;
                }
            }
        }
        if(flag)r=(res=md)-1;
        else l=md+1;
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 5031 ms 468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5031 ms 468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5031 ms 468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5031 ms 468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5031 ms 468 KB Time limit exceeded
2 Halted 0 ms 0 KB -