Submission #91493

# Submission time Handle Problem Language Result Execution time Memory
91493 2018-12-27T17:54:11 Z davitmarg Bomb (IZhO17_bomb) C++17
24 / 100
495 ms 49788 KB
/*
DEATH-MATCH
Davit-Marg
*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <ctype.h>
#include <stdlib.h>  
#include <fstream>  
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
using namespace std;

LL n, m,w,h;
LL mp[2503][2503];
char tmp;
int main()
{
	cin >> n >> m;
	w = m;
	h = n;
	for (LL i = 0; i < n; i++)
		for (LL j = 0; j < m; j++)
		{
			cin >> tmp;
			mp[i][j] = tmp - '0';
		}
	for (LL i = 0; i < n; i++)
	{
		LL l = 0;
		for (LL j = 0; j < m; j++)
			if (mp[i][j] != 1)
			{
				if (j != l)
					w = min(w, j - l);
				l = j + 1;
			}
		if (m != l)
			w = min(w, m - l);
	}


	for (LL i = 0; i < m; i++)
	{
		LL l = 0;
		for (LL j = 0; j < n; j++)
			if (mp[j][i] != 1)
			{
				if(j!=l)
					h = min(h, j - l);
				l = j + 1;
			}
		if (n != l)
			h = min(h, n - l);
	}
	cout << max(w * h,1ll) << endl;
	return 0;
}


/*


5 6
000000
111110
111111
111111
000000


7 8
01001110
01001110
01001100
00000000
01000000
01000000
01000000



7 8
00000011
00000000
00000011
00000000
00000011
00000000
00000000

7 8
11111111
11111111
11111111
11100111
11111111
11111111
11111111

7 8
00000000
00011000
00011000
00000000
00011111
00011111
00000000

*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 476 KB Output is correct
3 Correct 8 ms 10404 KB Output is correct
4 Correct 8 ms 10432 KB Output is correct
5 Correct 2 ms 10432 KB Output is correct
6 Correct 2 ms 10432 KB Output is correct
7 Correct 2 ms 10432 KB Output is correct
8 Incorrect 2 ms 10432 KB Output isn't correct
9 Incorrect 2 ms 10432 KB Output isn't correct
10 Incorrect 2 ms 10432 KB Output isn't correct
11 Incorrect 2 ms 10432 KB Output isn't correct
12 Incorrect 2 ms 10432 KB Output isn't correct
13 Correct 2 ms 10432 KB Output is correct
14 Correct 2 ms 10432 KB Output is correct
15 Incorrect 2 ms 10432 KB Output isn't correct
16 Correct 2 ms 10432 KB Output is correct
17 Correct 2 ms 10432 KB Output is correct
18 Incorrect 2 ms 10432 KB Output isn't correct
19 Incorrect 2 ms 10432 KB Output isn't correct
20 Incorrect 2 ms 10432 KB Output isn't correct
21 Incorrect 2 ms 10432 KB Output isn't correct
22 Incorrect 2 ms 10432 KB Output isn't correct
23 Incorrect 3 ms 10432 KB Output isn't correct
24 Incorrect 2 ms 10432 KB Output isn't correct
25 Incorrect 3 ms 10432 KB Output isn't correct
26 Correct 6 ms 10432 KB Output is correct
27 Correct 7 ms 10432 KB Output is correct
28 Incorrect 17 ms 10432 KB Output isn't correct
29 Incorrect 10 ms 10432 KB Output isn't correct
30 Incorrect 13 ms 10432 KB Output isn't correct
31 Incorrect 11 ms 10432 KB Output isn't correct
32 Incorrect 12 ms 10432 KB Output isn't correct
33 Incorrect 15 ms 10432 KB Output isn't correct
34 Incorrect 8 ms 10432 KB Output isn't correct
35 Incorrect 15 ms 10432 KB Output isn't correct
36 Correct 15 ms 10432 KB Output is correct
37 Incorrect 2 ms 10432 KB Output isn't correct
38 Correct 394 ms 49612 KB Output is correct
39 Incorrect 2 ms 49612 KB Output isn't correct
40 Incorrect 52 ms 49612 KB Output isn't correct
41 Incorrect 2 ms 49612 KB Output isn't correct
42 Incorrect 3 ms 49612 KB Output isn't correct
43 Correct 396 ms 49612 KB Output is correct
44 Incorrect 14 ms 49612 KB Output isn't correct
45 Incorrect 413 ms 49660 KB Output isn't correct
46 Correct 428 ms 49660 KB Output is correct
47 Incorrect 419 ms 49660 KB Output isn't correct
48 Incorrect 420 ms 49668 KB Output isn't correct
49 Correct 411 ms 49788 KB Output is correct
50 Incorrect 412 ms 49788 KB Output isn't correct
51 Incorrect 401 ms 49788 KB Output isn't correct
52 Incorrect 395 ms 49788 KB Output isn't correct
53 Incorrect 415 ms 49788 KB Output isn't correct
54 Incorrect 416 ms 49788 KB Output isn't correct
55 Incorrect 420 ms 49788 KB Output isn't correct
56 Correct 413 ms 49788 KB Output is correct
57 Incorrect 437 ms 49788 KB Output isn't correct
58 Incorrect 429 ms 49788 KB Output isn't correct
59 Incorrect 424 ms 49788 KB Output isn't correct
60 Correct 421 ms 49788 KB Output is correct
61 Correct 399 ms 49788 KB Output is correct
62 Correct 415 ms 49788 KB Output is correct
63 Correct 390 ms 49788 KB Output is correct
64 Correct 420 ms 49788 KB Output is correct
65 Incorrect 419 ms 49788 KB Output isn't correct
66 Incorrect 416 ms 49788 KB Output isn't correct
67 Incorrect 414 ms 49788 KB Output isn't correct
68 Incorrect 400 ms 49788 KB Output isn't correct
69 Incorrect 419 ms 49788 KB Output isn't correct
70 Incorrect 273 ms 49788 KB Output isn't correct
71 Incorrect 409 ms 49788 KB Output isn't correct
72 Incorrect 418 ms 49788 KB Output isn't correct
73 Incorrect 425 ms 49788 KB Output isn't correct
74 Incorrect 435 ms 49788 KB Output isn't correct
75 Incorrect 433 ms 49788 KB Output isn't correct
76 Incorrect 422 ms 49788 KB Output isn't correct
77 Incorrect 424 ms 49788 KB Output isn't correct
78 Incorrect 422 ms 49788 KB Output isn't correct
79 Incorrect 419 ms 49788 KB Output isn't correct
80 Incorrect 404 ms 49788 KB Output isn't correct
81 Incorrect 420 ms 49788 KB Output isn't correct
82 Incorrect 421 ms 49788 KB Output isn't correct
83 Incorrect 426 ms 49788 KB Output isn't correct
84 Incorrect 428 ms 49788 KB Output isn't correct
85 Incorrect 424 ms 49788 KB Output isn't correct
86 Incorrect 409 ms 49788 KB Output isn't correct
87 Incorrect 421 ms 49788 KB Output isn't correct
88 Incorrect 434 ms 49788 KB Output isn't correct
89 Incorrect 416 ms 49788 KB Output isn't correct
90 Incorrect 273 ms 49788 KB Output isn't correct
91 Incorrect 421 ms 49788 KB Output isn't correct
92 Incorrect 427 ms 49788 KB Output isn't correct
93 Incorrect 409 ms 49788 KB Output isn't correct
94 Incorrect 419 ms 49788 KB Output isn't correct
95 Incorrect 422 ms 49788 KB Output isn't correct
96 Incorrect 421 ms 49788 KB Output isn't correct
97 Incorrect 410 ms 49788 KB Output isn't correct
98 Incorrect 423 ms 49788 KB Output isn't correct
99 Incorrect 495 ms 49788 KB Output isn't correct
100 Incorrect 417 ms 49788 KB Output isn't correct