Submission #88182

# Submission time Handle Problem Language Result Execution time Memory
88182 2018-12-04T09:46:30 Z dimash241 Bomb (IZhO17_bomb) C++17
24 / 100
728 ms 32208 KB
# include <stdio.h>
# include <bits/stdc++.h>


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (int i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (int i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
short n, m;
bool a[2530][2530];
short l[2530][2530];
short r[2530][2530];
int f[2503];

int main () {
	SpeedForce;                                                      
	cin >> n >> m;
	int ans = 0;
   	int w = inf, h = inf;
   	
	For (i, 1, n) {
		For (j, 1, m) {
			char c;
			cin >> c;
			a[i][j] = c - '0';
			if (a[i][j] == 0) l[i][j] = j;
			else l[i][j] = l[i][j - 1];
		}
		r[i][m + 1] = m + 1;    		
		FOr(j, m, 1) {
			if (a[i][j] == 0) r[i][j] = j;
			else {
				r[i][j] = r[i][j + 1];
				w = min(w, (int)r[i][j] - l[i][j] - 1);
			}
		}
	}        

	For (j, 1, m) {
		For (i, 1, n) {
			if (a[i][j] == 0) l[i][j] = i;
			else l[i][j] = l[i - 1][j];
		}
		r[n + 1][j] = n + 1;
		FOr(i, n, 1) {
			if (a[i][j] == 0) r[i][j] = i;
			else {
				r[i][j] = r[i + 1][j];
				h = min(h, (int) r[i][j] - l[i][j] - 1);
			}
		}
	}

	For (i, 1, w) f[i] = h;
	ans = max(ans, f[1]);
	For (i, 2, n) {
		int cur = 0;
		For (j, 1, m) {
			if (a[i][j] == 0) cur =0;
			else {
				cur ++;
				f[cur] = min(f[cur], r[i][j] - l[i][j] - 1);
			}
		}
	}

	For (i, 2, w) {
		f[i] = min(f[i - 1], f[i]);
		ans = max(ans, f[i] * i);
	}

	cout << ans;

    return Accepted;
}

// Coded By OB
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 696 KB Output is correct
3 Correct 31 ms 26664 KB Output is correct
4 Correct 30 ms 26664 KB Output is correct
5 Correct 2 ms 26664 KB Output is correct
6 Correct 2 ms 26664 KB Output is correct
7 Correct 2 ms 26664 KB Output is correct
8 Incorrect 2 ms 26664 KB Output isn't correct
9 Incorrect 2 ms 26664 KB Output isn't correct
10 Incorrect 2 ms 26664 KB Output isn't correct
11 Incorrect 2 ms 26664 KB Output isn't correct
12 Incorrect 2 ms 26664 KB Output isn't correct
13 Correct 2 ms 26664 KB Output is correct
14 Correct 2 ms 26664 KB Output is correct
15 Incorrect 2 ms 26664 KB Output isn't correct
16 Correct 2 ms 26664 KB Output is correct
17 Correct 3 ms 26664 KB Output is correct
18 Incorrect 3 ms 26664 KB Output isn't correct
19 Incorrect 4 ms 26664 KB Output isn't correct
20 Incorrect 3 ms 26664 KB Output isn't correct
21 Incorrect 3 ms 26664 KB Output isn't correct
22 Incorrect 3 ms 26664 KB Output isn't correct
23 Incorrect 3 ms 26664 KB Output isn't correct
24 Incorrect 10 ms 26664 KB Output isn't correct
25 Incorrect 3 ms 26664 KB Output isn't correct
26 Correct 4 ms 26664 KB Output is correct
27 Correct 8 ms 26664 KB Output is correct
28 Incorrect 8 ms 26664 KB Output isn't correct
29 Incorrect 10 ms 26664 KB Output isn't correct
30 Incorrect 12 ms 26664 KB Output isn't correct
31 Incorrect 9 ms 26664 KB Output isn't correct
32 Incorrect 11 ms 26664 KB Output isn't correct
33 Incorrect 12 ms 26664 KB Output isn't correct
34 Incorrect 7 ms 26664 KB Output isn't correct
35 Incorrect 11 ms 26664 KB Output isn't correct
36 Correct 13 ms 26664 KB Output is correct
37 Incorrect 2 ms 26664 KB Output isn't correct
38 Correct 640 ms 31724 KB Output is correct
39 Incorrect 3 ms 31724 KB Output isn't correct
40 Incorrect 53 ms 31724 KB Output isn't correct
41 Incorrect 3 ms 31724 KB Output isn't correct
42 Incorrect 4 ms 31724 KB Output isn't correct
43 Correct 646 ms 31724 KB Output is correct
44 Incorrect 12 ms 31724 KB Output isn't correct
45 Incorrect 625 ms 31760 KB Output isn't correct
46 Correct 615 ms 31892 KB Output is correct
47 Incorrect 616 ms 31892 KB Output isn't correct
48 Incorrect 623 ms 31892 KB Output isn't correct
49 Correct 664 ms 31892 KB Output is correct
50 Incorrect 629 ms 31892 KB Output isn't correct
51 Incorrect 607 ms 31892 KB Output isn't correct
52 Incorrect 634 ms 31892 KB Output isn't correct
53 Incorrect 641 ms 31900 KB Output isn't correct
54 Incorrect 575 ms 31900 KB Output isn't correct
55 Incorrect 591 ms 31900 KB Output isn't correct
56 Correct 672 ms 31912 KB Output is correct
57 Incorrect 573 ms 31912 KB Output isn't correct
58 Incorrect 590 ms 31988 KB Output isn't correct
59 Incorrect 581 ms 31988 KB Output isn't correct
60 Correct 640 ms 31988 KB Output is correct
61 Correct 728 ms 31988 KB Output is correct
62 Correct 686 ms 31988 KB Output is correct
63 Correct 708 ms 31988 KB Output is correct
64 Correct 600 ms 31988 KB Output is correct
65 Incorrect 606 ms 31988 KB Output isn't correct
66 Incorrect 623 ms 31988 KB Output isn't correct
67 Incorrect 648 ms 31988 KB Output isn't correct
68 Incorrect 612 ms 32020 KB Output isn't correct
69 Incorrect 598 ms 32048 KB Output isn't correct
70 Incorrect 349 ms 32048 KB Output isn't correct
71 Incorrect 574 ms 32168 KB Output isn't correct
72 Incorrect 609 ms 32168 KB Output isn't correct
73 Incorrect 583 ms 32168 KB Output isn't correct
74 Incorrect 548 ms 32168 KB Output isn't correct
75 Incorrect 589 ms 32168 KB Output isn't correct
76 Incorrect 593 ms 32168 KB Output isn't correct
77 Incorrect 593 ms 32168 KB Output isn't correct
78 Incorrect 599 ms 32168 KB Output isn't correct
79 Incorrect 548 ms 32168 KB Output isn't correct
80 Incorrect 565 ms 32168 KB Output isn't correct
81 Incorrect 558 ms 32168 KB Output isn't correct
82 Incorrect 620 ms 32168 KB Output isn't correct
83 Incorrect 618 ms 32168 KB Output isn't correct
84 Incorrect 550 ms 32168 KB Output isn't correct
85 Incorrect 596 ms 32168 KB Output isn't correct
86 Incorrect 689 ms 32168 KB Output isn't correct
87 Incorrect 589 ms 32168 KB Output isn't correct
88 Incorrect 572 ms 32168 KB Output isn't correct
89 Incorrect 590 ms 32168 KB Output isn't correct
90 Incorrect 355 ms 32168 KB Output isn't correct
91 Incorrect 590 ms 32168 KB Output isn't correct
92 Incorrect 587 ms 32168 KB Output isn't correct
93 Incorrect 664 ms 32168 KB Output isn't correct
94 Incorrect 603 ms 32168 KB Output isn't correct
95 Incorrect 560 ms 32192 KB Output isn't correct
96 Incorrect 599 ms 32196 KB Output isn't correct
97 Incorrect 692 ms 32196 KB Output isn't correct
98 Incorrect 610 ms 32196 KB Output isn't correct
99 Incorrect 638 ms 32196 KB Output isn't correct
100 Incorrect 676 ms 32208 KB Output isn't correct