# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
96389 |
2019-02-09T05:33:15 Z |
choikiwon |
Bomb (IZhO17_bomb) |
C++17 |
|
729 ms |
112520 KB |
#include<bits/stdc++.h>
using namespace std;
const int MN = 2525;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int N, M;
char G[MN][MN];
int cc[MN][MN][4];
int dp(int r, int c, int d) {
if(r < 0 || N <= r || c < 0 || M <= c) return 0;
int &ret = cc[r][c][d];
if(ret != -1) return ret;
if(G[r][c] == '0') return 0;
return ret = dp(r + dy[d], c + dx[d], d) + 1;
}
int main() {
scanf("%d %d", &N, &M);
for(int i = 0; i < N; i++) {
scanf("\n");
for(int j = 0; j < M; j++) {
scanf("%c", &G[i][j]);
}
}
memset(cc, -1, sizeof(cc));
int mn1 = 1e9;
int mn2 = 1e9;
for(int i = 0; i < N; i++) for(int j = 0; j < M; j++) if(G[i][j] == '1') {
mn1 = min(mn1, dp(i, j, 0) + dp(i, j, 1) - 1);
mn2 = min(mn2, dp(i, j, 2) + dp(i, j, 3) - 1);
}
printf("%d", mn1 * mn2);
}
Compilation message
bomb.cpp: In function 'int main()':
bomb.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &N, &M);
~~~~~^~~~~~~~~~~~~~~~~
bomb.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("\n");
~~~~~^~~~~~
bomb.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%c", &G[i][j]);
~~~~~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
79 ms |
100088 KB |
Output is correct |
2 |
Correct |
79 ms |
100216 KB |
Output is correct |
3 |
Correct |
84 ms |
106360 KB |
Output is correct |
4 |
Correct |
82 ms |
106360 KB |
Output is correct |
5 |
Correct |
79 ms |
100088 KB |
Output is correct |
6 |
Correct |
78 ms |
100216 KB |
Output is correct |
7 |
Correct |
80 ms |
100092 KB |
Output is correct |
8 |
Incorrect |
83 ms |
100220 KB |
Output isn't correct |
9 |
Incorrect |
78 ms |
100236 KB |
Output isn't correct |
10 |
Incorrect |
80 ms |
100216 KB |
Output isn't correct |
11 |
Incorrect |
92 ms |
100136 KB |
Output isn't correct |
12 |
Incorrect |
88 ms |
100188 KB |
Output isn't correct |
13 |
Correct |
79 ms |
100212 KB |
Output is correct |
14 |
Correct |
85 ms |
100216 KB |
Output is correct |
15 |
Incorrect |
74 ms |
100216 KB |
Output isn't correct |
16 |
Correct |
93 ms |
100216 KB |
Output is correct |
17 |
Correct |
73 ms |
100216 KB |
Output is correct |
18 |
Incorrect |
79 ms |
100344 KB |
Output isn't correct |
19 |
Incorrect |
79 ms |
100344 KB |
Output isn't correct |
20 |
Incorrect |
80 ms |
100344 KB |
Output isn't correct |
21 |
Incorrect |
81 ms |
100344 KB |
Output isn't correct |
22 |
Incorrect |
82 ms |
100344 KB |
Output isn't correct |
23 |
Incorrect |
81 ms |
100344 KB |
Output isn't correct |
24 |
Incorrect |
80 ms |
100364 KB |
Output isn't correct |
25 |
Incorrect |
82 ms |
100344 KB |
Output isn't correct |
26 |
Correct |
80 ms |
100372 KB |
Output is correct |
27 |
Correct |
88 ms |
100860 KB |
Output is correct |
28 |
Incorrect |
87 ms |
100856 KB |
Output isn't correct |
29 |
Incorrect |
91 ms |
101112 KB |
Output isn't correct |
30 |
Incorrect |
91 ms |
101240 KB |
Output isn't correct |
31 |
Incorrect |
88 ms |
100984 KB |
Output isn't correct |
32 |
Incorrect |
96 ms |
101092 KB |
Output isn't correct |
33 |
Incorrect |
98 ms |
101240 KB |
Output isn't correct |
34 |
Incorrect |
83 ms |
100984 KB |
Output isn't correct |
35 |
Incorrect |
88 ms |
101328 KB |
Output isn't correct |
36 |
Correct |
98 ms |
101372 KB |
Output is correct |
37 |
Incorrect |
83 ms |
100216 KB |
Output isn't correct |
38 |
Correct |
692 ms |
112300 KB |
Output is correct |
39 |
Incorrect |
74 ms |
100216 KB |
Output isn't correct |
40 |
Incorrect |
144 ms |
103032 KB |
Output isn't correct |
41 |
Incorrect |
74 ms |
100216 KB |
Output isn't correct |
42 |
Incorrect |
81 ms |
100316 KB |
Output isn't correct |
43 |
Correct |
585 ms |
112376 KB |
Output is correct |
44 |
Incorrect |
94 ms |
101368 KB |
Output isn't correct |
45 |
Incorrect |
596 ms |
112300 KB |
Output isn't correct |
46 |
Correct |
458 ms |
112248 KB |
Output is correct |
47 |
Incorrect |
566 ms |
112248 KB |
Output isn't correct |
48 |
Incorrect |
493 ms |
112248 KB |
Output isn't correct |
49 |
Correct |
709 ms |
112424 KB |
Output is correct |
50 |
Incorrect |
503 ms |
112424 KB |
Output isn't correct |
51 |
Incorrect |
500 ms |
112248 KB |
Output isn't correct |
52 |
Incorrect |
514 ms |
112248 KB |
Output isn't correct |
53 |
Incorrect |
535 ms |
112364 KB |
Output isn't correct |
54 |
Incorrect |
417 ms |
112248 KB |
Output isn't correct |
55 |
Incorrect |
477 ms |
112168 KB |
Output isn't correct |
56 |
Correct |
703 ms |
112272 KB |
Output is correct |
57 |
Incorrect |
393 ms |
112176 KB |
Output isn't correct |
58 |
Incorrect |
444 ms |
112376 KB |
Output isn't correct |
59 |
Incorrect |
458 ms |
112376 KB |
Output isn't correct |
60 |
Correct |
508 ms |
112248 KB |
Output is correct |
61 |
Correct |
690 ms |
112412 KB |
Output is correct |
62 |
Correct |
676 ms |
112400 KB |
Output is correct |
63 |
Correct |
729 ms |
112224 KB |
Output is correct |
64 |
Correct |
415 ms |
112236 KB |
Output is correct |
65 |
Incorrect |
534 ms |
112316 KB |
Output isn't correct |
66 |
Incorrect |
495 ms |
112248 KB |
Output isn't correct |
67 |
Incorrect |
533 ms |
112520 KB |
Output isn't correct |
68 |
Incorrect |
538 ms |
112248 KB |
Output isn't correct |
69 |
Incorrect |
450 ms |
112484 KB |
Output isn't correct |
70 |
Incorrect |
384 ms |
108888 KB |
Output isn't correct |
71 |
Incorrect |
360 ms |
112348 KB |
Output isn't correct |
72 |
Incorrect |
391 ms |
112376 KB |
Output isn't correct |
73 |
Incorrect |
394 ms |
112324 KB |
Output isn't correct |
74 |
Incorrect |
430 ms |
112380 KB |
Output isn't correct |
75 |
Incorrect |
407 ms |
112248 KB |
Output isn't correct |
76 |
Incorrect |
422 ms |
112308 KB |
Output isn't correct |
77 |
Incorrect |
405 ms |
112268 KB |
Output isn't correct |
78 |
Incorrect |
429 ms |
112192 KB |
Output isn't correct |
79 |
Incorrect |
319 ms |
112248 KB |
Output isn't correct |
80 |
Incorrect |
350 ms |
112248 KB |
Output isn't correct |
81 |
Incorrect |
333 ms |
112292 KB |
Output isn't correct |
82 |
Incorrect |
421 ms |
112272 KB |
Output isn't correct |
83 |
Incorrect |
395 ms |
112248 KB |
Output isn't correct |
84 |
Incorrect |
346 ms |
112120 KB |
Output isn't correct |
85 |
Incorrect |
392 ms |
112252 KB |
Output isn't correct |
86 |
Incorrect |
635 ms |
112248 KB |
Output isn't correct |
87 |
Incorrect |
408 ms |
112348 KB |
Output isn't correct |
88 |
Incorrect |
451 ms |
112260 KB |
Output isn't correct |
89 |
Incorrect |
490 ms |
112220 KB |
Output isn't correct |
90 |
Incorrect |
334 ms |
108920 KB |
Output isn't correct |
91 |
Incorrect |
426 ms |
112292 KB |
Output isn't correct |
92 |
Incorrect |
525 ms |
112248 KB |
Output isn't correct |
93 |
Incorrect |
631 ms |
112500 KB |
Output isn't correct |
94 |
Incorrect |
483 ms |
112300 KB |
Output isn't correct |
95 |
Incorrect |
415 ms |
112184 KB |
Output isn't correct |
96 |
Incorrect |
448 ms |
112248 KB |
Output isn't correct |
97 |
Incorrect |
698 ms |
112380 KB |
Output isn't correct |
98 |
Incorrect |
425 ms |
112248 KB |
Output isn't correct |
99 |
Incorrect |
470 ms |
112236 KB |
Output isn't correct |
100 |
Incorrect |
704 ms |
112376 KB |
Output isn't correct |