# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
204146 | 2020-02-24T16:01:00 Z | Kalam | Luxury burrow (IZhO13_burrow) | C++11 | 587 ms | 18568 KB |
// KALAM # include<bits/stdc++.h> using namespace std; const int N = 1000 + 77; int n , m , k , a[N][N] , b[N][N] , c[N] , L[N] , R[N]; inline int Solve() { int res = 0; for(int i = 1;i <= m;++ i) { L[i] = i - 1; while(c[L[i]] >= c[i] && L[i] > 0) L[i] = L[L[i]]; } for(int i = m;i > 0;-- i) { R[i] = i + 1; while(c[R[i]] >= c[i] && R[i] <= m) R[i] = R[R[i]]; res = max(res , (R[i] - L[i] - 1) * c[i]); } return res; } inline int Check(int t) { int res = 0; for(int i = 1;i <= n;++ i) { for(int j = 1;j <= m;++ j) b[i][j] = (a[i][j] >= t ? 1 + b[i - 1][j] : 0); for(int j = 1;j <= m;++ j) c[j] = b[i][j]; res = max(res , Solve()); } return res; } int main() { scanf("%d %d %d" , & n , & m , & k); for(int i = 1;i <= n;++ i) for(int j = 1;j <= m;++ j) scanf("%d" , & a[i][j]); int le = 1 , ri = 1000000001; while(ri - le > 1) { int mid = ((le + ri) >> 1); if(Check(mid) >= k) le = mid; else ri = mid; } printf("%d %d\n" , le , Check(le)); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 504 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 6 ms | 632 KB | Output is correct |
6 | Correct | 6 ms | 632 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 10 ms | 1144 KB | Output is correct |
9 | Correct | 14 ms | 2168 KB | Output is correct |
10 | Correct | 31 ms | 2296 KB | Output is correct |
11 | Correct | 52 ms | 3064 KB | Output is correct |
12 | Correct | 32 ms | 4600 KB | Output is correct |
13 | Correct | 38 ms | 1528 KB | Output is correct |
14 | Correct | 88 ms | 4344 KB | Output is correct |
15 | Correct | 93 ms | 4344 KB | Output is correct |
16 | Correct | 93 ms | 4856 KB | Output is correct |
17 | Correct | 103 ms | 5112 KB | Output is correct |
18 | Correct | 238 ms | 8184 KB | Output is correct |
19 | Correct | 273 ms | 8184 KB | Output is correct |
20 | Correct | 518 ms | 12792 KB | Output is correct |
21 | Correct | 465 ms | 14328 KB | Output is correct |
22 | Correct | 584 ms | 18568 KB | Output is correct |
23 | Correct | 587 ms | 18552 KB | Output is correct |
24 | Correct | 399 ms | 11256 KB | Output is correct |
25 | Correct | 425 ms | 11768 KB | Output is correct |