Submission #833365

#TimeUsernameProblemLanguageResultExecution timeMemory
833365vjudge1Bomb (IZhO17_bomb)C++98
24 / 100
33 ms6572 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m, minh = 69420, minw = 69420, urutan;
	string s;
	vector<string> grid;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> s;
		grid.push_back(s);
	}
	for(int i = 0; i < n; i++){
		urutan = 0;
		for(int j = 0; j < m; j++){
			if(grid[i][j] == '1'){
				urutan++;	
			}
			else{
				if(urutan != 0){
					minw = min(urutan, minw);
				}
				urutan = 0;
			}
		}
		if(urutan != 0){
			minw = min(urutan, minw);
		}
	}
	if(urutan != 0){
		minw = min(urutan, minw);
	}
	for(int i = 0; i < m; i++){
		urutan = 0;
		for(int j = 0; j < n; j++){
			if(grid[j][i] == '1'){
				urutan++;	
			}
			else{
				if(urutan != 0){
					minh = min(urutan, minh);
				}
				urutan = 0;
			}
		}
		if(urutan != 0){
			minh = min(urutan, minh);
		}
	}
	if(urutan != 0){
		minh = min(urutan, minh);
	}
	if(minh == 69420 || minw == 69420){
		cout << 0 << endl;
	}
	//cout << minh << " " << minw << endl;
	else cout << minh*minw;
}

Compilation message (stderr)

bomb.cpp: In function 'int main()':
bomb.cpp:7:40: warning: 'urutan' may be used uninitialized in this function [-Wmaybe-uninitialized]
    7 |  int n, m, minh = 69420, minw = 69420, urutan;
      |                                        ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...