#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;
template<typename X>
using ordered_set = tree<X, null_type, less<X>, 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 - 1 < R; a++) {
ordered_set<int> os;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
os.insert(Q[a + i][j]);
}
}
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]);
}
ans = min(ans, *os.find_by_order(mid));
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2564 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2564 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
46 ms |
2652 KB |
Output is correct |
5 |
Correct |
42 ms |
2396 KB |
Output is correct |
6 |
Correct |
42 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2564 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
46 ms |
2652 KB |
Output is correct |
5 |
Correct |
42 ms |
2396 KB |
Output is correct |
6 |
Correct |
42 ms |
2652 KB |
Output is correct |
7 |
Correct |
2474 ms |
6392 KB |
Output is correct |
8 |
Correct |
1898 ms |
7056 KB |
Output is correct |
9 |
Correct |
1995 ms |
5828 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2564 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
46 ms |
2652 KB |
Output is correct |
5 |
Correct |
42 ms |
2396 KB |
Output is correct |
6 |
Correct |
42 ms |
2652 KB |
Output is correct |
7 |
Correct |
2474 ms |
6392 KB |
Output is correct |
8 |
Correct |
1898 ms |
7056 KB |
Output is correct |
9 |
Correct |
1995 ms |
5828 KB |
Output is correct |
10 |
Execution timed out |
5047 ms |
31320 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2564 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
46 ms |
2652 KB |
Output is correct |
5 |
Correct |
42 ms |
2396 KB |
Output is correct |
6 |
Correct |
42 ms |
2652 KB |
Output is correct |
7 |
Correct |
2474 ms |
6392 KB |
Output is correct |
8 |
Correct |
1898 ms |
7056 KB |
Output is correct |
9 |
Correct |
1995 ms |
5828 KB |
Output is correct |
10 |
Execution timed out |
5047 ms |
31320 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |