Submission #91360

#TimeUsernameProblemLanguageResultExecution timeMemory
91360emil_physmathBomb (IZhO17_bomb)C++14
24 / 100
328 ms119408 KiB
#include <iostream>
#include <stdio.h>
using namespace std;

bool a[2505][2505], temp[2505][2505];

int FindLen(int n, int m);
int main()
{
	int n, m;
	cin>>n>>m;
	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);
		}
	int len=FindLen(n, m);
	for (int i=0; i<n; i++)
		for (int j=0; j<m; j++)
			temp[j][i]=a[i][j];
	swap(n, m);
	for (int i=0; i<n; i++)
		for (int j=0; j<m; j++)
			a[i][j]=temp[i][j];
	int wid=FindLen(n, m);
	cout<<wid*len<<'\n';

	char I;
	cin >> I;
	return 0;
}

int FindLen(int n, int m)
{
	int minLen=m;
	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++;
			minLen=min(minLen, j-stj+1);
			stj=j;
		}
	return minLen;
}

Compilation message (stderr)

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