# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1039488 | ArthuroWich | Quality Of Living (IOI10_quality) | C++17 | 5050 ms | 35096 KiB |
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 "quality.h"
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
int ans = INT_MAX, med, n, m;
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
int n = R, m = C, med = H*W/2, ans = INT_MAX;
for (int j1 = 0; j1 < m; j1++) {
int j2 = j1+W-1;
if (j2 >= m) {
break;
}
indexed_set c;
for (int i = 0; i < H; i++) {
for (int j = j1; j <= j2; j++) {
c.insert({Q[i][j], i*C+j});
}
}
pair<int, int> p = *c.find_by_order(med);
ans = min(ans, p.first);
for (int i2 = H; i2 < R; i2++) {
int i1 = i2-H;
for (int j = j1; j <= j2; j++) {
c.erase({Q[i1][j], i1*C+j});
}
for (int j = j1; j <= j2; j++) {
c.insert({Q[i2][j], i2*C+j});
}
p = *c.find_by_order(med);
ans = min(ans, p.first);
}
}
return ans;
}
Compilation message (stderr)
# | 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... |