This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include "quality.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
ios_base::sync_with_stdio(0);\
cin.tie(0);\
cout.tie(0)\
typedef tree<
pii,
null_type,
less<pii>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
int rectangle(int r, int c, int h, int w, int Q[3001][3001]) {
int res = 1e9, tt = 0;
for(int i = 1; i <= r - h + 1; i++){
ordered_set st;
for(int a = 1; a < w; a++){
for(int b = i; b <= i + h - 1; b++){
st.insert({Q[b - 1][a - 1], tt++});
}
}
for(int a = w; a <= c; a++){
for(int b = i; b <= i + h - 1; b++){
st.insert({Q[b - 1][a - 1], tt++});
}
if(a > w){
for(int b = i; b <= i + h - 1; b++){
st.erase(st.lower_bound({Q[b - 1][a - 1], 0}));
}
}
res = min(res, (*st.find_by_order(h * w / 2)).first);
}
}
return res;
}
# | 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... |