답안 #388274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
388274 2021-04-10T18:07:56 Z patrikpavic2 Bomb (IZhO17_bomb) C++17
0 / 100
1 ms 340 KB
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 2505;

int n, m;
char s[N][N];

int main(){
	freopen("bomb.in", "r", stdin);
	freopen("bomb.out", "w", stdout);
	scanf("%d%d", &n, &m);
	for(int i = 0;i < n;i++)
		for(int j = 0;j < m;j++)
			scanf(" %c", &s[i][j]);
	int ansi = n, ansj = m;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			if(s[i][j] != '1') continue;
			int il = i, ir = i;
			int jl = j, jr = j;
			while(il > 0 && s[il - 1][j] == '1') il--;
			while(ir + 1 < n && s[ir + 1][j] == '1') ir++;
			while(jl > 0 && s[i][jl - 1] == '1') jl--;
			while(jr + 1 < m && s[i][jr + 1] == '1') jr++;
			ansi = min(ansi, ir - il + 1);
			ansj = min(ansj, jr - jl + 1);
		}
	}
	printf("%d\n", ansi * ansj);
	return 0;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:12:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   12 |  freopen("bomb.in", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bomb.cpp:13:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   13 |  freopen("bomb.out", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bomb.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
bomb.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |    scanf(" %c", &s[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Incorrect 0 ms 204 KB Output isn't correct
10 Incorrect 0 ms 204 KB Output isn't correct
11 Incorrect 0 ms 204 KB Output isn't correct
12 Incorrect 1 ms 204 KB Output isn't correct
13 Incorrect 0 ms 204 KB Output isn't correct
14 Incorrect 0 ms 208 KB Output isn't correct
15 Incorrect 0 ms 204 KB Output isn't correct
16 Incorrect 0 ms 204 KB Output isn't correct
17 Incorrect 0 ms 204 KB Output isn't correct
18 Incorrect 0 ms 208 KB Output isn't correct
19 Incorrect 1 ms 204 KB Output isn't correct
20 Incorrect 0 ms 208 KB Output isn't correct
21 Incorrect 0 ms 204 KB Output isn't correct
22 Incorrect 0 ms 204 KB Output isn't correct
23 Incorrect 0 ms 204 KB Output isn't correct
24 Incorrect 0 ms 204 KB Output isn't correct
25 Incorrect 0 ms 204 KB Output isn't correct
26 Incorrect 0 ms 204 KB Output isn't correct
27 Incorrect 0 ms 204 KB Output isn't correct
28 Incorrect 0 ms 204 KB Output isn't correct
29 Incorrect 0 ms 204 KB Output isn't correct
30 Incorrect 0 ms 204 KB Output isn't correct
31 Incorrect 0 ms 204 KB Output isn't correct
32 Incorrect 0 ms 204 KB Output isn't correct
33 Incorrect 0 ms 204 KB Output isn't correct
34 Incorrect 0 ms 204 KB Output isn't correct
35 Incorrect 0 ms 204 KB Output isn't correct
36 Incorrect 1 ms 204 KB Output isn't correct
37 Incorrect 0 ms 204 KB Output isn't correct
38 Incorrect 0 ms 204 KB Output isn't correct
39 Incorrect 1 ms 204 KB Output isn't correct
40 Incorrect 0 ms 204 KB Output isn't correct
41 Incorrect 0 ms 204 KB Output isn't correct
42 Incorrect 0 ms 204 KB Output isn't correct
43 Incorrect 1 ms 204 KB Output isn't correct
44 Incorrect 1 ms 204 KB Output isn't correct
45 Incorrect 0 ms 204 KB Output isn't correct
46 Incorrect 0 ms 204 KB Output isn't correct
47 Incorrect 0 ms 204 KB Output isn't correct
48 Incorrect 1 ms 204 KB Output isn't correct
49 Incorrect 0 ms 204 KB Output isn't correct
50 Incorrect 0 ms 204 KB Output isn't correct
51 Incorrect 0 ms 204 KB Output isn't correct
52 Incorrect 0 ms 204 KB Output isn't correct
53 Incorrect 0 ms 204 KB Output isn't correct
54 Incorrect 0 ms 204 KB Output isn't correct
55 Incorrect 0 ms 204 KB Output isn't correct
56 Incorrect 1 ms 204 KB Output isn't correct
57 Incorrect 0 ms 204 KB Output isn't correct
58 Incorrect 0 ms 204 KB Output isn't correct
59 Incorrect 0 ms 204 KB Output isn't correct
60 Incorrect 0 ms 204 KB Output isn't correct
61 Incorrect 1 ms 204 KB Output isn't correct
62 Incorrect 0 ms 204 KB Output isn't correct
63 Incorrect 0 ms 204 KB Output isn't correct
64 Incorrect 0 ms 204 KB Output isn't correct
65 Incorrect 0 ms 204 KB Output isn't correct
66 Incorrect 0 ms 204 KB Output isn't correct
67 Incorrect 0 ms 204 KB Output isn't correct
68 Incorrect 0 ms 204 KB Output isn't correct
69 Incorrect 0 ms 204 KB Output isn't correct
70 Incorrect 0 ms 204 KB Output isn't correct
71 Incorrect 0 ms 204 KB Output isn't correct
72 Incorrect 0 ms 204 KB Output isn't correct
73 Incorrect 0 ms 204 KB Output isn't correct
74 Incorrect 0 ms 204 KB Output isn't correct
75 Incorrect 0 ms 204 KB Output isn't correct
76 Incorrect 0 ms 204 KB Output isn't correct
77 Incorrect 1 ms 204 KB Output isn't correct
78 Incorrect 0 ms 204 KB Output isn't correct
79 Incorrect 0 ms 204 KB Output isn't correct
80 Incorrect 0 ms 204 KB Output isn't correct
81 Incorrect 0 ms 204 KB Output isn't correct
82 Incorrect 1 ms 208 KB Output isn't correct
83 Incorrect 0 ms 204 KB Output isn't correct
84 Incorrect 1 ms 204 KB Output isn't correct
85 Incorrect 1 ms 204 KB Output isn't correct
86 Incorrect 1 ms 204 KB Output isn't correct
87 Incorrect 0 ms 204 KB Output isn't correct
88 Incorrect 0 ms 204 KB Output isn't correct
89 Incorrect 0 ms 204 KB Output isn't correct
90 Incorrect 0 ms 204 KB Output isn't correct
91 Incorrect 0 ms 204 KB Output isn't correct
92 Incorrect 0 ms 204 KB Output isn't correct
93 Incorrect 0 ms 204 KB Output isn't correct
94 Incorrect 0 ms 204 KB Output isn't correct
95 Incorrect 0 ms 204 KB Output isn't correct
96 Incorrect 0 ms 204 KB Output isn't correct
97 Incorrect 1 ms 340 KB Output isn't correct
98 Incorrect 1 ms 204 KB Output isn't correct
99 Incorrect 0 ms 204 KB Output isn't correct
100 Incorrect 0 ms 204 KB Output isn't correct