이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "quality.h"
#include <bits/stdc++.h>
using namespace std;
#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>
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
int ans = R * C;
int mid = H * W / 2;
for (int a = 0; a + H <= R; a++) {
ordered_set os;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
os.insert(Q[a + i][j]);
}
}
// cerr << *os.find_by_order(mid) << " ";
ans = min(ans, *os.find_by_order(mid));
for (int b = 0; b + W < C; b++) {
// remove in column b, add in column b+W
for (int i = 0; i < H; i++) {
os.erase(Q[a + i][b]);
os.insert(Q[a + i][b + W]);
}
// cerr << *os.find_by_order(mid) << " ";
ans = min(ans, *os.find_by_order(mid));
}
// cerr << endl;
}
// cerr << endl;
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... |