Submission #833269

#TimeUsernameProblemLanguageResultExecution timeMemory
833269vjudge1Bomb (IZhO17_bomb)C++17
24 / 100
137 ms10568 KiB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define pll pair<ll, ll>
using namespace std;
ll n, m, hor, ver;
string s[3000];

int main(){
	cin >> n >> m;
	for(int i=0; i<n; i++){
		cin >> s[i];
	}
	
	//cari minimum di horizontal
	vector<int> tmp;
	for(int i=0; i<n; i++){
		int cnt=0;
		for(int j=0; j<=m; j++){
			if(j==m || s[i][j]=='0'){
				if(cnt>0) tmp.pb(cnt); cnt=0;
			}
			else cnt++;
		}
	}
	sort(tmp.begin(), tmp.end());
	if(tmp.size()>0) hor=tmp[0];
	tmp.clear();
	
	//cari minimum di vertikal
	for(int i=0; i<m; i++){
		int cnt=0;
		for(int j=0; j<=n; j++){
			if(j==n || s[j][i]=='0'){
				if(cnt>0) tmp.pb(cnt); cnt=0;
			}
			else cnt++;
		}
	}
	sort(tmp.begin(), tmp.end());
	if(tmp.size()>0) ver=tmp[0];
	cout << hor*ver << endl;
	return 0;
}

/*

10001
11111
11111
11111
















*/

Compilation message (stderr)

bomb.cpp: In function 'int main()':
bomb.cpp:23:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   23 |     if(cnt>0) tmp.pb(cnt); cnt=0;
      |     ^~
bomb.cpp:23:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   23 |     if(cnt>0) tmp.pb(cnt); cnt=0;
      |                            ^~~
bomb.cpp:37:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   37 |     if(cnt>0) tmp.pb(cnt); cnt=0;
      |     ^~
bomb.cpp:37:28: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   37 |     if(cnt>0) tmp.pb(cnt); cnt=0;
      |                            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...