# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1263963 | liangjeremy | Quality Of Living (IOI10_quality) | C++20 | 0 ms | 0 KiB |
#include "quality.h"
#include<bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;
using db=double;
using sll=__int128;
using lb=long double;
int rectangle(int r, int c, int h, int w, int Q[1001][1001]){
vector<vector<int>>a(r+1,vector<int>(c+1));
for(int i=1; i<=r; i++){
for(int j=1; j<=c; j++){
a[i][j]=Q[i-1][j-1];
}
}
int ans=1e18;
for(int i=1; i+h-1<=r; i++){
for(int j=1; j+w-1<=c; j++){
vector<int>v;
for(int ii=i; ii<=i+h-1; ii++){
for(int jj=j; jj<=j+w-1; jj++){
v.push_back(a[ii][jj]);
}
}
sort(v.begin(),v.end()); ans=min(ans,v[h*w/2]);
}
}
return ans;
}