This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <set>
#include <algorithm>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int rectangle(int R,int C,int H,int W,int Q[3001][3001])
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int ans=1e9+10;
for (int i=0;i<=R-H;i++)
{
set<int>s;
for (int j=i;j<i+H;j++)
for (int k=0;k<W;k++)
s.insert(Q[j][k]);
auto z=end(s);
z=prev(z,s.size()/2+1);
ans=min(ans,*z);
for (int j=W;j<C;j++)
{
for (int k=i;k<i+H;k++)
{
s.insert(Q[k][j]);
s.erase(Q[k][j-W]);
}
auto z=end(s);
z=prev(z,s.size()/2+1);
ans=min(ans,*z);
}
}
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... |