# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
288006 | dolijan | Quality Of Living (IOI10_quality) | C++14 | 0 ms | 0 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 <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
const int mn=3010;
int rectangle1(int r,int c,int h,int w,int q[mn][mn])
{
int mn=r*c;
for(int i=0;i<=r-h;i++)
{
for(int j=0;j<=c-w;j++)
{
vector<int> v;
for(int aa=i;aa<i+h;aa++)
{
for(int bb=j;bb<j+w;bb++)
{
v.pb(q[aa][bb]);
}
}
sort(v.begin(),v.end());
int srednji=v.size()/2;
mn=min(mn,v[srednji]);
}
}
return mn;
}
int rectangle(int R, int C, int H, int W, int Q[3010][3010]) {
return rectangle1(R,C,H,W,Q);
}/*
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int r,c,h,w;
cin>>r>>c>>h>>w;
int a[mn][mn];
for(int i=0;i<r;i++)
for(int j=0;j<c;j++) cin>>a[i][j];
cout<<rectangle(r,c,h,w,a)<<endl;
return 0;
}*/