# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
88172 |
2018-12-04T08:15:14 Z |
dimash241 |
Bomb (IZhO17_bomb) |
C++17 |
|
703 ms |
31888 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 main () {
SpeedForce;
cin >> n >> m;
int ans = n * m;
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);
}
}
}
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 |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
3 |
Correct |
33 ms |
26672 KB |
Output is correct |
4 |
Correct |
34 ms |
26680 KB |
Output is correct |
5 |
Correct |
2 ms |
26680 KB |
Output is correct |
6 |
Correct |
2 ms |
26680 KB |
Output is correct |
7 |
Correct |
2 ms |
26680 KB |
Output is correct |
8 |
Incorrect |
2 ms |
26680 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
26680 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
26680 KB |
Output isn't correct |
11 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
26680 KB |
Output isn't correct |
13 |
Correct |
2 ms |
26680 KB |
Output is correct |
14 |
Correct |
2 ms |
26680 KB |
Output is correct |
15 |
Incorrect |
2 ms |
26680 KB |
Output isn't correct |
16 |
Correct |
3 ms |
26680 KB |
Output is correct |
17 |
Correct |
3 ms |
26680 KB |
Output is correct |
18 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
20 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
21 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
22 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
23 |
Incorrect |
4 ms |
26680 KB |
Output isn't correct |
24 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
25 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
26 |
Correct |
4 ms |
26680 KB |
Output is correct |
27 |
Correct |
9 ms |
26680 KB |
Output is correct |
28 |
Incorrect |
8 ms |
26680 KB |
Output isn't correct |
29 |
Incorrect |
10 ms |
26680 KB |
Output isn't correct |
30 |
Incorrect |
11 ms |
26680 KB |
Output isn't correct |
31 |
Incorrect |
8 ms |
26680 KB |
Output isn't correct |
32 |
Incorrect |
11 ms |
26680 KB |
Output isn't correct |
33 |
Incorrect |
13 ms |
26680 KB |
Output isn't correct |
34 |
Incorrect |
8 ms |
26680 KB |
Output isn't correct |
35 |
Incorrect |
13 ms |
26680 KB |
Output isn't correct |
36 |
Correct |
14 ms |
26680 KB |
Output is correct |
37 |
Incorrect |
3 ms |
26680 KB |
Output isn't correct |
38 |
Correct |
616 ms |
31636 KB |
Output is correct |
39 |
Incorrect |
2 ms |
31636 KB |
Output isn't correct |
40 |
Incorrect |
49 ms |
31636 KB |
Output isn't correct |
41 |
Incorrect |
2 ms |
31636 KB |
Output isn't correct |
42 |
Incorrect |
3 ms |
31636 KB |
Output isn't correct |
43 |
Correct |
592 ms |
31644 KB |
Output is correct |
44 |
Incorrect |
12 ms |
31644 KB |
Output isn't correct |
45 |
Incorrect |
578 ms |
31648 KB |
Output isn't correct |
46 |
Correct |
597 ms |
31648 KB |
Output is correct |
47 |
Incorrect |
583 ms |
31648 KB |
Output isn't correct |
48 |
Incorrect |
599 ms |
31720 KB |
Output isn't correct |
49 |
Correct |
703 ms |
31776 KB |
Output is correct |
50 |
Incorrect |
620 ms |
31776 KB |
Output isn't correct |
51 |
Incorrect |
607 ms |
31776 KB |
Output isn't correct |
52 |
Incorrect |
627 ms |
31776 KB |
Output isn't correct |
53 |
Incorrect |
619 ms |
31776 KB |
Output isn't correct |
54 |
Incorrect |
580 ms |
31780 KB |
Output isn't correct |
55 |
Incorrect |
575 ms |
31780 KB |
Output isn't correct |
56 |
Correct |
692 ms |
31780 KB |
Output is correct |
57 |
Incorrect |
571 ms |
31780 KB |
Output isn't correct |
58 |
Incorrect |
552 ms |
31780 KB |
Output isn't correct |
59 |
Incorrect |
545 ms |
31780 KB |
Output isn't correct |
60 |
Correct |
595 ms |
31804 KB |
Output is correct |
61 |
Correct |
649 ms |
31804 KB |
Output is correct |
62 |
Correct |
645 ms |
31804 KB |
Output is correct |
63 |
Correct |
688 ms |
31804 KB |
Output is correct |
64 |
Correct |
553 ms |
31804 KB |
Output is correct |
65 |
Incorrect |
610 ms |
31804 KB |
Output isn't correct |
66 |
Incorrect |
613 ms |
31804 KB |
Output isn't correct |
67 |
Incorrect |
639 ms |
31804 KB |
Output isn't correct |
68 |
Incorrect |
650 ms |
31804 KB |
Output isn't correct |
69 |
Incorrect |
579 ms |
31804 KB |
Output isn't correct |
70 |
Incorrect |
353 ms |
31804 KB |
Output isn't correct |
71 |
Incorrect |
558 ms |
31804 KB |
Output isn't correct |
72 |
Incorrect |
558 ms |
31804 KB |
Output isn't correct |
73 |
Incorrect |
581 ms |
31804 KB |
Output isn't correct |
74 |
Incorrect |
539 ms |
31804 KB |
Output isn't correct |
75 |
Incorrect |
561 ms |
31804 KB |
Output isn't correct |
76 |
Incorrect |
547 ms |
31804 KB |
Output isn't correct |
77 |
Incorrect |
566 ms |
31804 KB |
Output isn't correct |
78 |
Incorrect |
561 ms |
31804 KB |
Output isn't correct |
79 |
Incorrect |
514 ms |
31804 KB |
Output isn't correct |
80 |
Incorrect |
511 ms |
31836 KB |
Output isn't correct |
81 |
Incorrect |
533 ms |
31836 KB |
Output isn't correct |
82 |
Incorrect |
557 ms |
31836 KB |
Output isn't correct |
83 |
Incorrect |
538 ms |
31836 KB |
Output isn't correct |
84 |
Incorrect |
494 ms |
31836 KB |
Output isn't correct |
85 |
Incorrect |
551 ms |
31836 KB |
Output isn't correct |
86 |
Incorrect |
610 ms |
31836 KB |
Output isn't correct |
87 |
Incorrect |
520 ms |
31836 KB |
Output isn't correct |
88 |
Incorrect |
546 ms |
31836 KB |
Output isn't correct |
89 |
Incorrect |
579 ms |
31888 KB |
Output isn't correct |
90 |
Incorrect |
348 ms |
31888 KB |
Output isn't correct |
91 |
Incorrect |
565 ms |
31888 KB |
Output isn't correct |
92 |
Incorrect |
582 ms |
31888 KB |
Output isn't correct |
93 |
Incorrect |
627 ms |
31888 KB |
Output isn't correct |
94 |
Incorrect |
595 ms |
31888 KB |
Output isn't correct |
95 |
Incorrect |
580 ms |
31888 KB |
Output isn't correct |
96 |
Incorrect |
597 ms |
31888 KB |
Output isn't correct |
97 |
Incorrect |
672 ms |
31888 KB |
Output isn't correct |
98 |
Incorrect |
585 ms |
31888 KB |
Output isn't correct |
99 |
Incorrect |
598 ms |
31888 KB |
Output isn't correct |
100 |
Incorrect |
633 ms |
31888 KB |
Output isn't correct |