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 <bits/stdc++.h>
using namespace std;
#include "quality.h"
//#define int long long
typedef long long ll;
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
int lo = 1, hi = R * C, ans = lo;
int A[R+1][C+1] = {0};
while(lo <= hi){
int mid = (lo + hi) >> 1;
for(int i=1;i<=R;i++){
for(int j=1;j<=C;j++){
A[i][j] = (Q[i-1][j-1] <= mid ? 1 : -1);
A[i][j] += A[i][j-1] + A[i-1][j] - A[i-1][j-1];
}
}
bool f = 0;
for(int i=H;i<=R;i++){
for(int j=W;j<=C;j++){
if(A[i][j] - A[i-H][j] - A[i][j-W] + A[i-H][j-W] >= 1)f = 1;
}
}
if(f)ans = mid, hi = mid - 1;
else lo = mid + 1;
}
return ans;
}
# | 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... |