# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
287993 | 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 a[mn][mn];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int r,c,h,w;
cin>>r>>c>>h>>w;
for(int i=0;i<r;i++)
for(int j=0;j<c;j++) cin>>a[i][j];
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(a[aa][bb]);
}
}
sort(v.begin(),v.end());
int srednji=v.size()/2;
mn=min(mn,v[srednji]);
}
}
cout<<mn<<endl;
return 0;
}