Submission #88170

# Submission time Handle Problem Language Result Execution time Memory
88170 2018-12-04T08:05:00 Z dimash241 Bomb (IZhO17_bomb) C++14
14 / 100
547 ms 132096 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};
 
int n, m;
int a[3030][3030];
int l[3030][3030];
int r[3030][3030];
int d[3030][3030];
int 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, r[i][j] - l[i][j] - 1);
   				h = min(h, 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 3 ms 376 KB Output is correct
2 Correct 3 ms 900 KB Output is correct
3 Correct 56 ms 50740 KB Output is correct
4 Correct 54 ms 50740 KB Output is correct
5 Correct 2 ms 50740 KB Output is correct
6 Correct 2 ms 50740 KB Output is correct
7 Correct 3 ms 50740 KB Output is correct
8 Incorrect 3 ms 50740 KB Output isn't correct
9 Incorrect 3 ms 50740 KB Output isn't correct
10 Incorrect 3 ms 50740 KB Output isn't correct
11 Incorrect 3 ms 50740 KB Output isn't correct
12 Incorrect 3 ms 50740 KB Output isn't correct
13 Correct 2 ms 50740 KB Output is correct
14 Correct 3 ms 50740 KB Output is correct
15 Incorrect 3 ms 50740 KB Output isn't correct
16 Correct 3 ms 50740 KB Output is correct
17 Correct 4 ms 50740 KB Output is correct
18 Incorrect 3 ms 50740 KB Output isn't correct
19 Incorrect 4 ms 50740 KB Output isn't correct
20 Incorrect 4 ms 50740 KB Output isn't correct
21 Incorrect 3 ms 50740 KB Output isn't correct
22 Incorrect 4 ms 50740 KB Output isn't correct
23 Incorrect 4 ms 50740 KB Output isn't correct
24 Incorrect 4 ms 50740 KB Output isn't correct
25 Incorrect 5 ms 50740 KB Output isn't correct
26 Correct 5 ms 50740 KB Output is correct
27 Correct 13 ms 50740 KB Output is correct
28 Incorrect 12 ms 50740 KB Output isn't correct
29 Incorrect 17 ms 50740 KB Output isn't correct
30 Incorrect 21 ms 50740 KB Output isn't correct
31 Incorrect 16 ms 50740 KB Output isn't correct
32 Incorrect 16 ms 50740 KB Output isn't correct
33 Incorrect 19 ms 50740 KB Output isn't correct
34 Incorrect 11 ms 50740 KB Output isn't correct
35 Incorrect 18 ms 50740 KB Output isn't correct
36 Correct 20 ms 50740 KB Output is correct
37 Incorrect 2 ms 50740 KB Output isn't correct
38 Runtime error 532 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
39 Runtime error 3 ms 132096 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.
40 Runtime error 88 ms 132096 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.
41 Runtime error 3 ms 132096 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.
42 Runtime error 5 ms 132096 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.
43 Runtime error 511 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
44 Runtime error 22 ms 132096 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.
45 Runtime error 501 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
46 Runtime error 515 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
47 Runtime error 503 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
48 Runtime error 501 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
49 Runtime error 509 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
50 Runtime error 526 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
51 Runtime error 501 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
52 Runtime error 502 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
53 Runtime error 492 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
54 Runtime error 456 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
55 Runtime error 478 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
56 Runtime error 505 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
57 Runtime error 513 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
58 Runtime error 483 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
59 Runtime error 495 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
60 Runtime error 499 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
61 Runtime error 507 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
62 Runtime error 519 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
63 Runtime error 521 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
64 Runtime error 496 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
65 Runtime error 492 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
66 Runtime error 492 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
67 Runtime error 528 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
68 Runtime error 515 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
69 Runtime error 492 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
70 Runtime error 513 ms 132096 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.
71 Runtime error 471 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
72 Runtime error 492 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
73 Runtime error 504 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
74 Runtime error 484 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
75 Runtime error 509 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
76 Runtime error 518 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
77 Runtime error 505 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
78 Runtime error 506 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
79 Runtime error 487 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
80 Runtime error 512 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
81 Runtime error 479 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
82 Runtime error 471 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
83 Runtime error 486 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
84 Runtime error 481 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
85 Runtime error 461 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
86 Runtime error 493 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
87 Runtime error 494 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
88 Runtime error 491 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
89 Runtime error 503 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
90 Runtime error 547 ms 132096 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.
91 Runtime error 478 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
92 Runtime error 483 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
93 Runtime error 482 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
94 Runtime error 469 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
95 Runtime error 464 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
96 Runtime error 474 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
97 Runtime error 508 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
98 Runtime error 479 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
99 Runtime error 466 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
100 Runtime error 475 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)