이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "quality.h"
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define f first
#define s second
#define pb push_back
#define p_b pop_back
using namespace std;
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
int l = 1, r = R * C, ans = R * C;
while(l <= r)
{
int grid[3001][3001];
int mid = (l + r) / 2, maxx = 0;
for(int i = 0; i < R; i++)
{
for(int j = 0; j < C; j++)
{
int sum = 0;
grid[i][j] = (Q[i][j] <= mid);
if(i)
grid[i][j] += grid[i-1][j];
if(j)
grid[i][j] += grid[i][j-1];
if(i && j)
grid[i][j] -= grid[i-1][j-1];
sum = grid[i][j];
if(i - H >= 0)
sum -= grid[i-H][j];
if(j - W >= 0)
sum -= grid[i][j-W];
if(i - H >= 0 && j - W >= 0)
sum += grid[i-H][j-W];
maxx = max(maxx, sum);
}
}
if(maxx > H * W / 2)
{
ans = min(ans, mid);
r = mid - 1;
}
else
l = 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... |