Submission #595779

# Submission time Handle Problem Language Result Execution time Memory
595779 2022-07-14T06:30:36 Z fuad27 Quality Of Living (IOI10_quality) C++17
100 / 100
1601 ms 106356 KB
#include "quality.h"
#include<bits/stdc++.h>
long long pref[3010][3010];
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
	int lo = -1, hi = R*C;
	while(hi-lo>1) {
		int mid = (lo+hi)/2;
		for(int i = 0;i<R;i++)pref[i][0]=0;
		for(int i = 0;i<C;i++)pref[0][i]=0;
		for(int i = 1;i<=R;i++) {
			for(int j = 1;j<=C;j++) {
				pref[i][j]=pref[i-1][j]+pref[i][j-1]-pref[i-1][j-1]+(Q[i-1][j-1]<=mid);
			}
		}
		bool check=false;
		for(int i = H;i<=R;i++) {
			for(int j = W;j<=C;j++) {
				if((pref[i][j]-pref[i-H][j]+pref[i-H][j-W]-pref[i][j-W])>(H*W)/2)check=true;
			}
		}
		if(check) {
			hi=mid;
		}
		else {
			lo=mid;
		}
	}
	return hi;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 2 ms 1236 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 3 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 2 ms 1236 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 3 ms 1108 KB Output is correct
7 Correct 15 ms 3672 KB Output is correct
8 Correct 14 ms 3776 KB Output is correct
9 Correct 13 ms 3620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 2 ms 1236 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 3 ms 1108 KB Output is correct
7 Correct 15 ms 3672 KB Output is correct
8 Correct 14 ms 3776 KB Output is correct
9 Correct 13 ms 3620 KB Output is correct
10 Correct 169 ms 20084 KB Output is correct
11 Correct 163 ms 20088 KB Output is correct
12 Correct 115 ms 14216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 2 ms 1236 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 3 ms 1108 KB Output is correct
7 Correct 15 ms 3672 KB Output is correct
8 Correct 14 ms 3776 KB Output is correct
9 Correct 13 ms 3620 KB Output is correct
10 Correct 169 ms 20084 KB Output is correct
11 Correct 163 ms 20088 KB Output is correct
12 Correct 115 ms 14216 KB Output is correct
13 Correct 1575 ms 106136 KB Output is correct
14 Correct 1601 ms 106356 KB Output is correct
15 Correct 1457 ms 106272 KB Output is correct