# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
887220 | Muhammad_Aneeq | Quality Of Living (IOI10_quality) | C++17 | 5058 ms | 25940 KiB |
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 <set>
#include <algorithm>
using namespace std;
int rectangle(int R,int C,int H,int W,int Q[3001][3001])
{ 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]);
if (s.size()>(H*W)/2+1)
s.erase(*--end(s));
}
auto z=--end(s);
ans=min(ans,*z);
// print(s);
for (int j=W;j<C;j++)
{
for (int k=i;k<i+H;k++)
s.erase(Q[k][j-W]);
for (int k=i;k<i+H;k++)
{
s.insert(Q[k][j]);
if (s.size()>(H*W)/2+1)
s.erase(*--end(s));
}
// print(s);
auto z=--end(s);
ans=min(ans,*z);
}
}
return ans;
}
Compilation message (stderr)
# | 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... |