Submission #833241

#TimeUsernameProblemLanguageResultExecution timeMemory
833241vjudge1Bomb (IZhO17_bomb)C++11
2 / 100
196 ms6500 KiB
#include <stdio.h>

int main() {
	int n,m;
	scanf("%d %d",&n,&m); getchar();
	
	bool arr[n][m];
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			char c;
			scanf("%c",&c);
			arr[i][j] = (c == '1');
		} getchar();
	}
	
	int h = 5000, w = 5000;
	for(int i = 0; i < n; i++) {
		int thisH = 5000, cur = 0;
		for(int j = 0; j < m; j++) {
			if(arr[i][j])
				cur++;
			if(cur && (!arr[i][j] || j == m-1)) {
				thisH = cur < thisH ? cur : thisH;
				cur = 0;
			}
		}
		h = thisH < h ? thisH : h;
	}
	for(int i = 0; i < m; i++) {
		int thisW = 5000, cur = 0;
		for(int j = 0; j < n; j++) {
			if(arr[j][i])
				cur++;
			if(cur && (!arr[j][i] || j == n-1)) {
				thisW = cur < thisW ? cur : thisW;
				cur = 0;
			}
		}
		w = thisW < w ? thisW : w;
	}
	
	printf("%d\n",h < 5000 && w < 5000 ? h*w : 0);
	
	return 0;
}

Compilation message (stderr)

bomb.cpp: In function 'int main()':
bomb.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |  scanf("%d %d",&n,&m); getchar();
      |  ~~~~~^~~~~~~~~~~~~~~
bomb.cpp:11:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |    scanf("%c",&c);
      |    ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...