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>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//#include "grader.cpp"
#include "quality.h"
using namespace std;
#define cin(vec) for(auto& i : vec) cin >> i
#define cout(vec) for(auto& i : vec) cout << i << " "; cout << "\n";
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define loop(i,a,b) for (int i = a; i < b; i++)
#define F first
#define S second
#define pb(n) push_back(n)
#define pf(n) push_front(n)
#define dci(d) fixed<<setprecision(d)
#define sp ' '
#define el '\n'
#define all(v) v.begin(),v.end()
#define f find_by_order
int rectangle(int n, int m, int r, int c, int a[3001][3001]) {
ordered_set s;
int ans=1e9;
for(int i=0;i<n-r;i++){
s.clear();
for(int k=i;k<i+r;k++){
for(int j=0;j<c;j++){
s.insert(a[k][j]);
}
}
ans=min(ans,*s.f(s.size()/2));
for(int j=0;j<m-c;j++){
for(int k=i;k<r+i;k++){
s.erase(a[k][j]);
}
for(int k=i;k<r+i;k++){
s.insert(a[k][j+c]);
}
ans=min(ans,*s.f(s.size()/2));
}
}
ans=min(ans,*s.f(s.size()/2));
return ans;
}
# | 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... |