Submission #88181

# Submission time Handle Problem Language Result Execution time Memory
88181 2018-12-04T09:43:47 Z dimash241 Bomb (IZhO17_bomb) C++14
24 / 100
693 ms 31876 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;
	For (i, 1, 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, 1, w) 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 628 KB Output is correct
3 Correct 30 ms 26884 KB Output is correct
4 Correct 30 ms 26884 KB Output is correct
5 Correct 2 ms 26884 KB Output is correct
6 Correct 2 ms 26884 KB Output is correct
7 Correct 2 ms 26884 KB Output is correct
8 Incorrect 2 ms 26884 KB Output isn't correct
9 Incorrect 2 ms 26884 KB Output isn't correct
10 Incorrect 2 ms 26884 KB Output isn't correct
11 Incorrect 3 ms 26884 KB Output isn't correct
12 Incorrect 3 ms 26884 KB Output isn't correct
13 Correct 3 ms 26884 KB Output is correct
14 Correct 2 ms 26884 KB Output is correct
15 Incorrect 2 ms 26884 KB Output isn't correct
16 Correct 3 ms 26884 KB Output is correct
17 Correct 3 ms 26884 KB Output is correct
18 Incorrect 3 ms 26884 KB Output isn't correct
19 Incorrect 4 ms 26884 KB Output isn't correct
20 Incorrect 3 ms 26884 KB Output isn't correct
21 Incorrect 3 ms 26884 KB Output isn't correct
22 Incorrect 3 ms 26884 KB Output isn't correct
23 Incorrect 2 ms 26884 KB Output isn't correct
24 Incorrect 3 ms 26884 KB Output isn't correct
25 Incorrect 3 ms 26884 KB Output isn't correct
26 Correct 4 ms 26884 KB Output is correct
27 Correct 6 ms 26884 KB Output is correct
28 Incorrect 8 ms 26884 KB Output isn't correct
29 Incorrect 10 ms 26884 KB Output isn't correct
30 Incorrect 12 ms 26884 KB Output isn't correct
31 Incorrect 10 ms 26884 KB Output isn't correct
32 Incorrect 11 ms 26884 KB Output isn't correct
33 Incorrect 11 ms 26884 KB Output isn't correct
34 Incorrect 7 ms 26884 KB Output isn't correct
35 Incorrect 10 ms 26884 KB Output isn't correct
36 Correct 13 ms 26884 KB Output is correct
37 Incorrect 1 ms 26884 KB Output isn't correct
38 Correct 623 ms 31612 KB Output is correct
39 Incorrect 2 ms 31612 KB Output isn't correct
40 Incorrect 58 ms 31612 KB Output isn't correct
41 Incorrect 3 ms 31612 KB Output isn't correct
42 Incorrect 3 ms 31612 KB Output isn't correct
43 Correct 594 ms 31612 KB Output is correct
44 Incorrect 12 ms 31612 KB Output isn't correct
45 Incorrect 601 ms 31612 KB Output isn't correct
46 Correct 600 ms 31764 KB Output is correct
47 Incorrect 588 ms 31764 KB Output isn't correct
48 Incorrect 604 ms 31764 KB Output isn't correct
49 Correct 654 ms 31764 KB Output is correct
50 Incorrect 620 ms 31764 KB Output isn't correct
51 Incorrect 634 ms 31764 KB Output isn't correct
52 Incorrect 618 ms 31764 KB Output isn't correct
53 Incorrect 617 ms 31764 KB Output isn't correct
54 Incorrect 576 ms 31764 KB Output isn't correct
55 Incorrect 564 ms 31764 KB Output isn't correct
56 Correct 675 ms 31764 KB Output is correct
57 Incorrect 583 ms 31764 KB Output isn't correct
58 Incorrect 587 ms 31764 KB Output isn't correct
59 Incorrect 589 ms 31764 KB Output isn't correct
60 Correct 597 ms 31764 KB Output is correct
61 Correct 690 ms 31764 KB Output is correct
62 Correct 693 ms 31764 KB Output is correct
63 Correct 687 ms 31764 KB Output is correct
64 Correct 570 ms 31764 KB Output is correct
65 Incorrect 591 ms 31764 KB Output isn't correct
66 Incorrect 612 ms 31764 KB Output isn't correct
67 Incorrect 614 ms 31764 KB Output isn't correct
68 Incorrect 637 ms 31764 KB Output isn't correct
69 Incorrect 596 ms 31764 KB Output isn't correct
70 Incorrect 348 ms 31764 KB Output isn't correct
71 Incorrect 563 ms 31764 KB Output isn't correct
72 Incorrect 583 ms 31764 KB Output isn't correct
73 Incorrect 560 ms 31764 KB Output isn't correct
74 Incorrect 570 ms 31764 KB Output isn't correct
75 Incorrect 558 ms 31764 KB Output isn't correct
76 Incorrect 576 ms 31764 KB Output isn't correct
77 Incorrect 558 ms 31764 KB Output isn't correct
78 Incorrect 578 ms 31764 KB Output isn't correct
79 Incorrect 522 ms 31764 KB Output isn't correct
80 Incorrect 538 ms 31764 KB Output isn't correct
81 Incorrect 548 ms 31764 KB Output isn't correct
82 Incorrect 559 ms 31764 KB Output isn't correct
83 Incorrect 592 ms 31764 KB Output isn't correct
84 Incorrect 537 ms 31764 KB Output isn't correct
85 Incorrect 596 ms 31800 KB Output isn't correct
86 Incorrect 674 ms 31800 KB Output isn't correct
87 Incorrect 592 ms 31800 KB Output isn't correct
88 Incorrect 612 ms 31800 KB Output isn't correct
89 Incorrect 626 ms 31800 KB Output isn't correct
90 Incorrect 362 ms 31800 KB Output isn't correct
91 Incorrect 608 ms 31800 KB Output isn't correct
92 Incorrect 613 ms 31800 KB Output isn't correct
93 Incorrect 688 ms 31800 KB Output isn't correct
94 Incorrect 608 ms 31800 KB Output isn't correct
95 Incorrect 580 ms 31800 KB Output isn't correct
96 Incorrect 592 ms 31828 KB Output isn't correct
97 Incorrect 652 ms 31876 KB Output isn't correct
98 Incorrect 583 ms 31876 KB Output isn't correct
99 Incorrect 603 ms 31876 KB Output isn't correct
100 Incorrect 649 ms 31876 KB Output isn't correct