#include <bits/stdc++.h>
#include "quality.h"
using namespace std;
#define ll long long
#define vb vector<bool>
#define pb push_back
#define ff(aa, bb, cc) for(ll aa = bb; aa < cc; aa++)
#define vl vector<ll>
#define pll pair<ll, ll>
#define fi first
#define se second
#define ed "\n"
#define all(aaa) aaa.begin(), aaa.end()
#define rall(aaa) aaa.rbegin(), aaa.rend()
ll MOD = 1e9+7;
int rectangle(int r, int c, int h, int w, int Q[3001][3001]){
//vector<vector<set<ll>>> calc(r-h+1, vector<set<ll>>(c-w+1));
//vector<vl> erasi(r-h+1);
//vector<vector<vl>> erasj(r-h+1, vector<vl>(c-w+1));
ll minn = c*r;
ll mid = (h*w)/2;
ff(i, 0, r-h+1){
ff(j, 0, c-w+1){
vl cur;
ff(curi, i, i+h){
ff(curj, j, j+w){
cur.pb(Q[curi][curj]);
}
}
/*ff(curi, 0, cur.size()){
//cout << cur[curi] << " ";
}*/
sort(all(cur));
//cout << ed;
//cout << cur[mid] << ed;
minn = min(minn, cur[mid]);
}
}
return minn;
}
/*
static int R,C,H,W,Q[3001][3001],i,j,ans;
int main(){
scanf("%d%d%d%d",&R,&C,&H,&W);
for (i=0;i<R;i++) for (j=0;j<C;j++) scanf("%d",&Q[i][j]);
ans = rectangle(R,C,H,W,Q);
printf("%d\n",ans);
return 0;
}
*/
# | 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... |