#include "quality.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
template <class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int rectangle(int n, int m, int h, int w, int a[3001][3001]) {
Tree<int> s;
int mn = INT_MAX;
for (int i = 0; i+h-1 < n; i++) for (int j = 0; j+w-1 < m; j++) {
if (j == 0) {
s.clear();
for (int x = i; x < i+h; x++) for (int y = j; y < j+w; y++) s.insert(a[x][y]);
} else {
for (int x = i; x < i+h; x++) s.erase(s.find(a[x][j-1])), s.insert(a[x][j+w-1]);
}
mn = min(mn, *s.find_by_order((h*w)/2));
}
return mn;
}
# | 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... |