답안 #91367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91367 2018-12-27T09:13:52 Z emil_physmath Bomb (IZhO17_bomb) C++11
7 / 100
1000 ms 6492 KB
#include <iostream>
#include <stdio.h>
using namespace std;

bool a[2505][2505];

int FindWid(int n, int m);
int FindLen(int n, int m);
int main()
{
	int n, m;
	cin>>n>>m;
  	if (n>5 && m>5)
      for(;;);
	for (int i=0; i<n; i++)
		for (int j=0; j<m; j++)
		{
			char temp;
			scanf(" %c", &temp);
			a[i][j]=(temp=='1'?true:false);
		}
	cout<<FindWid(n, m)*FindLen(n, m)<<'\n';

	char I;
	cin >> I;
	return 0;
}
int FindWid(int n, int m)
{
	int minWid=-1;
	for (int j=0; j<m; j++)
		for (int sti=0; sti<n; sti++)
		{
			int i=sti;
			if (!a[i][j]) continue;
			while (i+1<n && a[i+1][j])
				i++;
			if (minWid==-1 || i-sti+1<minWid)
				minWid=i-sti+1;
			sti=i;
		}
	return minWid==-1?0:minWid;
}
int FindLen(int n, int m)
{
	int minLen=-1;
	for (int i=0; i<n; i++)
		for (int stj=0; stj<m; stj++)
		{
			int j=stj;
			if (!a[i][j]) continue;
			while (j+1<m && a[i][j+1])
				j++;
			if (minLen==-1 || j-stj+1<minLen)
				minLen=j-stj+1;
			stj=j;
		}
	return minLen==-1?0:minLen;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:14:7: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
       for(;;);
       ^~~
bomb.cpp:15:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for (int i=0; i<n; i++)
  ^~~
bomb.cpp:19:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c", &temp);
    ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 5 ms 6468 KB Output is correct
4 Correct 5 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Execution timed out 1082 ms 6492 KB Time limit exceeded
9 Execution timed out 1069 ms 6492 KB Time limit exceeded
10 Execution timed out 1070 ms 6492 KB Time limit exceeded
11 Execution timed out 1066 ms 6492 KB Time limit exceeded
12 Execution timed out 1072 ms 6492 KB Time limit exceeded
13 Execution timed out 1072 ms 6492 KB Time limit exceeded
14 Execution timed out 1074 ms 6492 KB Time limit exceeded
15 Execution timed out 1071 ms 6492 KB Time limit exceeded
16 Execution timed out 1075 ms 6492 KB Time limit exceeded
17 Execution timed out 1074 ms 6492 KB Time limit exceeded
18 Execution timed out 1079 ms 6492 KB Time limit exceeded
19 Execution timed out 1076 ms 6492 KB Time limit exceeded
20 Execution timed out 1078 ms 6492 KB Time limit exceeded
21 Execution timed out 1081 ms 6492 KB Time limit exceeded
22 Execution timed out 1080 ms 6492 KB Time limit exceeded
23 Execution timed out 1084 ms 6492 KB Time limit exceeded
24 Execution timed out 1077 ms 6492 KB Time limit exceeded
25 Execution timed out 1072 ms 6492 KB Time limit exceeded
26 Execution timed out 1079 ms 6492 KB Time limit exceeded
27 Execution timed out 1071 ms 6492 KB Time limit exceeded
28 Execution timed out 1073 ms 6492 KB Time limit exceeded
29 Execution timed out 1088 ms 6492 KB Time limit exceeded
30 Execution timed out 1078 ms 6492 KB Time limit exceeded
31 Execution timed out 1086 ms 6492 KB Time limit exceeded
32 Execution timed out 1083 ms 6492 KB Time limit exceeded
33 Execution timed out 1067 ms 6492 KB Time limit exceeded
34 Execution timed out 1079 ms 6492 KB Time limit exceeded
35 Execution timed out 1078 ms 6492 KB Time limit exceeded
36 Execution timed out 1082 ms 6492 KB Time limit exceeded
37 Execution timed out 1081 ms 6492 KB Time limit exceeded
38 Execution timed out 1077 ms 6492 KB Time limit exceeded
39 Execution timed out 1083 ms 6492 KB Time limit exceeded
40 Execution timed out 1087 ms 6492 KB Time limit exceeded
41 Execution timed out 1079 ms 6492 KB Time limit exceeded
42 Execution timed out 1089 ms 6492 KB Time limit exceeded
43 Execution timed out 1073 ms 6492 KB Time limit exceeded
44 Execution timed out 1079 ms 6492 KB Time limit exceeded
45 Execution timed out 1079 ms 6492 KB Time limit exceeded
46 Execution timed out 1080 ms 6492 KB Time limit exceeded
47 Execution timed out 1078 ms 6492 KB Time limit exceeded
48 Execution timed out 1073 ms 6492 KB Time limit exceeded
49 Execution timed out 1073 ms 6492 KB Time limit exceeded
50 Execution timed out 1076 ms 6492 KB Time limit exceeded
51 Execution timed out 1084 ms 6492 KB Time limit exceeded
52 Execution timed out 1080 ms 6492 KB Time limit exceeded
53 Execution timed out 1073 ms 6492 KB Time limit exceeded
54 Execution timed out 1068 ms 6492 KB Time limit exceeded
55 Execution timed out 1087 ms 6492 KB Time limit exceeded
56 Execution timed out 1076 ms 6492 KB Time limit exceeded
57 Execution timed out 1076 ms 6492 KB Time limit exceeded
58 Execution timed out 1085 ms 6492 KB Time limit exceeded
59 Execution timed out 1083 ms 6492 KB Time limit exceeded
60 Execution timed out 1080 ms 6492 KB Time limit exceeded
61 Execution timed out 1083 ms 6492 KB Time limit exceeded
62 Execution timed out 1073 ms 6492 KB Time limit exceeded
63 Execution timed out 1069 ms 6492 KB Time limit exceeded
64 Execution timed out 1082 ms 6492 KB Time limit exceeded
65 Execution timed out 1072 ms 6492 KB Time limit exceeded
66 Execution timed out 1078 ms 6492 KB Time limit exceeded
67 Execution timed out 1089 ms 6492 KB Time limit exceeded
68 Execution timed out 1077 ms 6492 KB Time limit exceeded
69 Execution timed out 1077 ms 6492 KB Time limit exceeded
70 Execution timed out 1081 ms 6492 KB Time limit exceeded
71 Execution timed out 1087 ms 6492 KB Time limit exceeded
72 Execution timed out 1081 ms 6492 KB Time limit exceeded
73 Execution timed out 1080 ms 6492 KB Time limit exceeded
74 Execution timed out 1090 ms 6492 KB Time limit exceeded
75 Execution timed out 1073 ms 6492 KB Time limit exceeded
76 Execution timed out 1087 ms 6492 KB Time limit exceeded
77 Execution timed out 1080 ms 6492 KB Time limit exceeded
78 Execution timed out 1081 ms 6492 KB Time limit exceeded
79 Execution timed out 1079 ms 6492 KB Time limit exceeded
80 Execution timed out 1079 ms 6492 KB Time limit exceeded
81 Execution timed out 1071 ms 6492 KB Time limit exceeded
82 Execution timed out 1081 ms 6492 KB Time limit exceeded
83 Execution timed out 1082 ms 6492 KB Time limit exceeded
84 Execution timed out 1072 ms 6492 KB Time limit exceeded
85 Execution timed out 1087 ms 6492 KB Time limit exceeded
86 Execution timed out 1074 ms 6492 KB Time limit exceeded
87 Execution timed out 1063 ms 6492 KB Time limit exceeded
88 Execution timed out 1069 ms 6492 KB Time limit exceeded
89 Execution timed out 1074 ms 6492 KB Time limit exceeded
90 Execution timed out 1088 ms 6492 KB Time limit exceeded
91 Execution timed out 1077 ms 6492 KB Time limit exceeded
92 Execution timed out 1081 ms 6492 KB Time limit exceeded
93 Execution timed out 1071 ms 6492 KB Time limit exceeded
94 Execution timed out 1078 ms 6492 KB Time limit exceeded
95 Execution timed out 1076 ms 6492 KB Time limit exceeded
96 Execution timed out 1087 ms 6492 KB Time limit exceeded
97 Execution timed out 1076 ms 6492 KB Time limit exceeded
98 Execution timed out 1078 ms 6492 KB Time limit exceeded
99 Execution timed out 1072 ms 6492 KB Time limit exceeded
100 Execution timed out 1085 ms 6492 KB Time limit exceeded