# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
83711 | mra2322001 | Luxury burrow (IZhO13_burrow) | C++14 | 700 ms | 3536 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 <bits/stdc++.h>
#define f0(i, n) for(int i(0); i < (n); i++)
#define f1(i, n) for(int i(1); i <= n; i++)
using namespace std;
typedef long long ll;
const int N = 402;
int m, n, a[N][N], k, ma[N], now = 0;
int calc(int k1, int k2, int cur){
int res = 0;
f1(i, n){
int j = i;
for(j; j <= n; j++){
if(ma[j] >= cur) continue;
else break;
}
--j;
res = max(res, (k2 - k1 + 1)*(j - i + 1));
i = j + 1;
}
return res;
}
bool check(int cur){
int res = 0;
f1(i, m){
f1(j, n) ma[j] = 1e9 + 100;
for(int j = i; j <= m; j++){
for(int x = 1; x <= n; x++){
ma[x] = min(ma[x], a[j][x]);
}
res = max(res, calc(i, j, cur));
}
}
if(res >= k) now = res;
return res >= k;
}
int main(){
ios_base::sync_with_stdio(0);
cin >> m >> n >> k;
f1(i, m) f1(j, n) cin >> a[i][j];
int l = 1, r = 1e9 + 2, ans = 1;
while(l <= r){
int mid = (l + r)/2;
if(check(mid)) l = mid + 1, ans = mid;
else r = mid - 1;
}
cout << ans << " " << now;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |