Submission #1102960

# Submission time Handle Problem Language Result Execution time Memory
1102960 2024-10-19T09:26:48 Z Muhammet Bomb (IZhO17_bomb) C++17
24 / 100
382 ms 107948 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 2505;

int n, m, a[N][N], b[N][N], c[N][N], d[N][N];

char e[N][N];

int main(){
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			cin >> e[i][j];
		}
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(e[i][j] == '1'){
				a[i][j] = a[i][j-1] + 1;
			}
			else {
				a[i][j] = 0;
			}
		}
	}
	for(int i = 1; i <= n; i++){
		for(int j = m; j >= 1; j--){
			if(e[i][j] == '1'){
				b[i][j] = b[i][j+1] + 1;
			}
			else {
				b[i][j] = 0;
			}
		}
	}
	for(int j = 1; j <= m; j++){
		for(int i = 1; i <= n; i++){
			if(e[i][j] == '1'){
				c[i][j] = c[i-1][j] + 1;
			}
			else {
				c[i][j] = 0;
			}
		}
	}
	for(int j = 1; j <= m; j++){
		for(int i = n; i >= 1; i--){
			if(e[i][j] == '1'){
				d[i][j] = d[i+1][j] + 1;
			}
			else {
				d[i][j] = 0;
			}
		}
	}
	int n1 = 1e9, m1 = 1e9;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(e[i][j] == '0') continue;
			n1 = min(n1, (c[i][j] + d[i][j]) - 1);
			m1 = min(m1, (a[i][j] + b[i][j]) - 1);
		}
	}
	if(n1 == 1e9 and m1 == 1e9) cout << 0;
	else cout << n1*m1;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8528 KB Output is correct
2 Correct 1 ms 2640 KB Output is correct
3 Correct 22 ms 73296 KB Output is correct
4 Correct 21 ms 73348 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Incorrect 1 ms 4688 KB Output isn't correct
9 Incorrect 1 ms 4688 KB Output isn't correct
10 Incorrect 1 ms 6480 KB Output isn't correct
11 Incorrect 1 ms 4688 KB Output isn't correct
12 Incorrect 2 ms 4688 KB Output isn't correct
13 Correct 1 ms 8580 KB Output is correct
14 Correct 1 ms 4688 KB Output is correct
15 Incorrect 1 ms 4688 KB Output isn't correct
16 Correct 1 ms 2640 KB Output is correct
17 Correct 3 ms 16976 KB Output is correct
18 Incorrect 3 ms 13136 KB Output isn't correct
19 Incorrect 3 ms 15184 KB Output isn't correct
20 Incorrect 3 ms 15184 KB Output isn't correct
21 Incorrect 2 ms 16976 KB Output isn't correct
22 Incorrect 3 ms 19024 KB Output isn't correct
23 Incorrect 3 ms 15184 KB Output isn't correct
24 Incorrect 3 ms 15184 KB Output isn't correct
25 Incorrect 3 ms 15184 KB Output isn't correct
26 Correct 3 ms 8016 KB Output is correct
27 Correct 6 ms 14284 KB Output is correct
28 Incorrect 6 ms 23632 KB Output isn't correct
29 Incorrect 7 ms 25936 KB Output isn't correct
30 Incorrect 12 ms 22608 KB Output isn't correct
31 Incorrect 8 ms 22608 KB Output isn't correct
32 Incorrect 8 ms 22608 KB Output isn't correct
33 Incorrect 11 ms 26704 KB Output isn't correct
34 Incorrect 6 ms 27296 KB Output isn't correct
35 Incorrect 14 ms 27472 KB Output isn't correct
36 Correct 13 ms 20304 KB Output is correct
37 Incorrect 1 ms 6736 KB Output isn't correct
38 Correct 236 ms 104548 KB Output is correct
39 Incorrect 1 ms 6736 KB Output isn't correct
40 Incorrect 38 ms 36976 KB Output isn't correct
41 Incorrect 1 ms 6736 KB Output isn't correct
42 Incorrect 3 ms 13648 KB Output isn't correct
43 Correct 265 ms 104540 KB Output is correct
44 Incorrect 11 ms 25680 KB Output isn't correct
45 Incorrect 237 ms 104520 KB Output isn't correct
46 Correct 247 ms 104520 KB Output is correct
47 Incorrect 313 ms 104520 KB Output isn't correct
48 Incorrect 227 ms 104520 KB Output isn't correct
49 Correct 278 ms 104524 KB Output is correct
50 Incorrect 256 ms 104520 KB Output isn't correct
51 Incorrect 273 ms 104720 KB Output isn't correct
52 Incorrect 254 ms 104548 KB Output isn't correct
53 Incorrect 257 ms 104672 KB Output isn't correct
54 Incorrect 273 ms 104552 KB Output isn't correct
55 Incorrect 264 ms 104520 KB Output isn't correct
56 Correct 282 ms 104548 KB Output is correct
57 Incorrect 264 ms 105544 KB Output isn't correct
58 Incorrect 265 ms 104552 KB Output isn't correct
59 Incorrect 249 ms 104556 KB Output isn't correct
60 Correct 255 ms 104528 KB Output is correct
61 Correct 267 ms 104520 KB Output is correct
62 Correct 370 ms 104552 KB Output is correct
63 Correct 267 ms 105680 KB Output is correct
64 Correct 286 ms 104520 KB Output is correct
65 Incorrect 282 ms 104552 KB Output isn't correct
66 Incorrect 298 ms 104544 KB Output isn't correct
67 Incorrect 279 ms 104560 KB Output isn't correct
68 Incorrect 263 ms 104548 KB Output isn't correct
69 Incorrect 270 ms 104520 KB Output isn't correct
70 Incorrect 159 ms 91504 KB Output isn't correct
71 Incorrect 225 ms 104524 KB Output isn't correct
72 Incorrect 228 ms 104556 KB Output isn't correct
73 Incorrect 225 ms 104520 KB Output isn't correct
74 Incorrect 212 ms 104556 KB Output isn't correct
75 Incorrect 265 ms 106764 KB Output isn't correct
76 Incorrect 240 ms 104520 KB Output isn't correct
77 Incorrect 223 ms 105892 KB Output isn't correct
78 Incorrect 223 ms 104520 KB Output isn't correct
79 Incorrect 234 ms 104552 KB Output isn't correct
80 Incorrect 261 ms 107492 KB Output isn't correct
81 Incorrect 297 ms 104544 KB Output isn't correct
82 Incorrect 324 ms 104556 KB Output isn't correct
83 Incorrect 314 ms 104548 KB Output isn't correct
84 Incorrect 325 ms 104520 KB Output isn't correct
85 Incorrect 270 ms 105996 KB Output isn't correct
86 Incorrect 324 ms 104616 KB Output isn't correct
87 Incorrect 278 ms 105888 KB Output isn't correct
88 Incorrect 272 ms 105808 KB Output isn't correct
89 Incorrect 329 ms 104556 KB Output isn't correct
90 Incorrect 183 ms 92032 KB Output isn't correct
91 Incorrect 293 ms 104548 KB Output isn't correct
92 Incorrect 284 ms 104868 KB Output isn't correct
93 Incorrect 276 ms 107948 KB Output isn't correct
94 Incorrect 265 ms 105520 KB Output isn't correct
95 Incorrect 272 ms 105944 KB Output isn't correct
96 Incorrect 282 ms 105988 KB Output isn't correct
97 Incorrect 273 ms 104808 KB Output isn't correct
98 Incorrect 245 ms 105612 KB Output isn't correct
99 Incorrect 382 ms 104464 KB Output isn't correct
100 Incorrect 266 ms 106204 KB Output isn't correct