Submission #497102

#TimeUsernameProblemLanguageResultExecution timeMemory
497102ACE_Bomb (IZhO17_bomb)C++17
24 / 100
433 ms12716 KiB
#include<bits/stdc++.h>
#define f first
#define s second
#define pii pair<int,int>
using namespace std;
int t, n, m, w, h;
char a[2505][2505];
main(){
	cin >> n >> m;
	w = m; h = n;
	for(int i = 1; i <= n; i++) {
		int x = 0;
		for(int j = 1; j <= m; j++) {
			cin >> a[i][j];
			if(a[i][j] == '0') {
				if(x) w = min(w,x);
				x = 0;
			}
			else x++;
		}
		if(x) w = min(w, x);
	}
	for(int j = 1; j <= m; j++) {
		int x = 0;
		for(int i = 1; i <= n; i++) {
			if(a[i][j] == '0') {
				if(x) h = min(h, x);
				x = 0;
			} else x++;
		}
		if(x) h = min(h, x);
	}
	cout << h * w;
}

Compilation message (stderr)

bomb.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...