# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
624949 | DrollWolf | Quality Of Living (IOI10_quality) | C++17 | 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>
using namespace std;
typedef long long int lli;
//const int N = 50e5+5;
//int arr[N];
int main()
{
lli r, c, h, w, i, j, k, l, mini;
cin>>r>>c>>h>>w;
lli arr[r][c];
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
cin>>arr[i][j];
}
mini= INT_MAX;
for(i=0;i<=r-h;i++)
{
for(j=0;j<=c-w;j++)
{
vector<lli> vect;
for(k=i;k<i+h;k++)
{
for(l=j;l<j+w;l++)
vect.push_back(arr[k][l]);
}
sort(vect.begin(), vect.end());
mini=min(mini, vect[(h*w)/2]);
}
}
cout<<mini;
//freopen("diamond.in","r",stdin);
//freopen("diamond.out","w",stdout);
}