Submission #88171

# Submission time Handle Problem Language Result Execution time Memory
88171 2018-12-04T08:08:27 Z dimash241 Bomb (IZhO17_bomb) C++14
24 / 100
765 ms 132080 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;
short a[3030][3030];
short l[3030][3030];
short r[3030][3030];
short d[3030][3030];
short u[3030][3030];

int main () {
	SpeedForce;                                                      
	cin >> n >> m;
	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];
		}
	}        

	For (j, 1, m) {
		For (i, 1, n) {
			if (a[i][j] == 0) u[i][j] = i;
			else u[i][j] = u[i - 1][j];
		}
		d[n + 1][j] = n + 1;
		FOr(i, n, 1) {
			if (a[i][j] == 0) d[i][j] = i;
			else d[i][j] = d[i + 1][j];
		}
	}

   	int ans = 0;
   	int w = inf, h = inf;
   	For (i, 1, n) {
   		For (j, 1, m) {
   			if (a[i][j] == 1) {
   				w = min(w, (int)r[i][j] - l[i][j] - 1);
   				h = min(h, (int)d[i][j] - u[i][j] - 1);
   			}
   		}
   	}

   	if (w != inf) ans = w * h;

   	//cout << w << ' ' << h << '\n';
   	cout << ans;

    return Accepted;
}

// Coded By OB
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 896 KB Output is correct
3 Correct 56 ms 50648 KB Output is correct
4 Correct 54 ms 50684 KB Output is correct
5 Correct 2 ms 50684 KB Output is correct
6 Correct 2 ms 50684 KB Output is correct
7 Correct 2 ms 50684 KB Output is correct
8 Incorrect 3 ms 50684 KB Output isn't correct
9 Incorrect 3 ms 50684 KB Output isn't correct
10 Incorrect 2 ms 50684 KB Output isn't correct
11 Incorrect 3 ms 50684 KB Output isn't correct
12 Incorrect 2 ms 50684 KB Output isn't correct
13 Correct 2 ms 50684 KB Output is correct
14 Correct 2 ms 50684 KB Output is correct
15 Incorrect 2 ms 50684 KB Output isn't correct
16 Correct 2 ms 50684 KB Output is correct
17 Correct 3 ms 50684 KB Output is correct
18 Incorrect 4 ms 50684 KB Output isn't correct
19 Incorrect 4 ms 50684 KB Output isn't correct
20 Incorrect 4 ms 50684 KB Output isn't correct
21 Incorrect 3 ms 50684 KB Output isn't correct
22 Incorrect 4 ms 50684 KB Output isn't correct
23 Incorrect 4 ms 50684 KB Output isn't correct
24 Incorrect 4 ms 50684 KB Output isn't correct
25 Incorrect 4 ms 50684 KB Output isn't correct
26 Correct 4 ms 50684 KB Output is correct
27 Correct 11 ms 50684 KB Output is correct
28 Incorrect 11 ms 50684 KB Output isn't correct
29 Incorrect 15 ms 50684 KB Output isn't correct
30 Incorrect 16 ms 50684 KB Output isn't correct
31 Incorrect 14 ms 50684 KB Output isn't correct
32 Incorrect 14 ms 50684 KB Output isn't correct
33 Incorrect 19 ms 50684 KB Output isn't correct
34 Incorrect 11 ms 50684 KB Output isn't correct
35 Incorrect 17 ms 50684 KB Output isn't correct
36 Correct 19 ms 50684 KB Output is correct
37 Incorrect 3 ms 50684 KB Output isn't correct
38 Correct 757 ms 82080 KB Output is correct
39 Incorrect 3 ms 82080 KB Output isn't correct
40 Incorrect 71 ms 82080 KB Output isn't correct
41 Incorrect 3 ms 82080 KB Output isn't correct
42 Incorrect 5 ms 82080 KB Output isn't correct
43 Correct 740 ms 83396 KB Output is correct
44 Incorrect 19 ms 83396 KB Output isn't correct
45 Incorrect 740 ms 83556 KB Output isn't correct
46 Correct 749 ms 83556 KB Output is correct
47 Incorrect 733 ms 83556 KB Output isn't correct
48 Incorrect 743 ms 83556 KB Output isn't correct
49 Correct 761 ms 83672 KB Output is correct
50 Incorrect 740 ms 88464 KB Output isn't correct
51 Incorrect 713 ms 88464 KB Output isn't correct
52 Incorrect 719 ms 88464 KB Output isn't correct
53 Incorrect 696 ms 88464 KB Output isn't correct
54 Incorrect 687 ms 88572 KB Output isn't correct
55 Incorrect 691 ms 90928 KB Output isn't correct
56 Correct 729 ms 97272 KB Output is correct
57 Incorrect 700 ms 100080 KB Output isn't correct
58 Incorrect 678 ms 100144 KB Output isn't correct
59 Incorrect 693 ms 100144 KB Output isn't correct
60 Correct 705 ms 100144 KB Output is correct
61 Correct 703 ms 100144 KB Output is correct
62 Correct 750 ms 100200 KB Output is correct
63 Correct 755 ms 100200 KB Output is correct
64 Correct 733 ms 100200 KB Output is correct
65 Incorrect 725 ms 100200 KB Output isn't correct
66 Incorrect 723 ms 100896 KB Output isn't correct
67 Incorrect 705 ms 106028 KB Output isn't correct
68 Incorrect 702 ms 111620 KB Output isn't correct
69 Incorrect 697 ms 111620 KB Output isn't correct
70 Incorrect 452 ms 111620 KB Output isn't correct
71 Incorrect 680 ms 111620 KB Output isn't correct
72 Incorrect 687 ms 111620 KB Output isn't correct
73 Incorrect 686 ms 111620 KB Output isn't correct
74 Incorrect 715 ms 111620 KB Output isn't correct
75 Incorrect 687 ms 111620 KB Output isn't correct
76 Incorrect 694 ms 111620 KB Output isn't correct
77 Incorrect 719 ms 111620 KB Output isn't correct
78 Incorrect 706 ms 111956 KB Output isn't correct
79 Incorrect 676 ms 117664 KB Output isn't correct
80 Incorrect 698 ms 122164 KB Output isn't correct
81 Incorrect 692 ms 122164 KB Output isn't correct
82 Incorrect 695 ms 122164 KB Output isn't correct
83 Incorrect 690 ms 122164 KB Output isn't correct
84 Incorrect 698 ms 122164 KB Output isn't correct
85 Incorrect 738 ms 122164 KB Output isn't correct
86 Incorrect 745 ms 122164 KB Output isn't correct
87 Incorrect 753 ms 122164 KB Output isn't correct
88 Incorrect 755 ms 122164 KB Output isn't correct
89 Incorrect 738 ms 122164 KB Output isn't correct
90 Incorrect 477 ms 122164 KB Output isn't correct
91 Incorrect 737 ms 129588 KB Output isn't correct
92 Runtime error 758 ms 131904 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
93 Runtime error 765 ms 131984 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
94 Runtime error 746 ms 132064 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
95 Runtime error 719 ms 132064 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
96 Runtime error 714 ms 132080 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
97 Runtime error 709 ms 132080 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
98 Runtime error 698 ms 132080 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
99 Runtime error 748 ms 132080 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
100 Runtime error 739 ms 132080 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.