Submission #915519

# Submission time Handle Problem Language Result Execution time Memory
915519 2024-01-24T06:04:07 Z vjudge1 Bomb (IZhO17_bomb) C++17
Compilation error
0 ms 0 KB
/*#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll n,m,k,cnt;
void anomalous_solve()
{
	cin>>n>>m;
	char a[n+1][m+1];
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>a[i][j];
		}
	}
	ll mx1=1e9,mx2=1e9;
	cnt=0;
	for(int i=1;i<=n;i++)
	{
		cnt=0;
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]=='1')cnt++;
			else if(cnt>0)
			{
				mx2=min(mx2,cnt);
				cnt=0;
			}
		}
		if(cnt>0)
		{
			mx2=min(mx2,cnt);
		}
	}
	for(int j=1;j<=m;j++)
	{
		cnt=0;
		for(int i=1;i<=n;i++)
		{
			if(a[i][j]=='1')cnt++;
			else if(cnt>0)
			{
				mx1=min(mx1,cnt);
				cnt=0;
			}
		}
		if(cnt>0)
		{
			mx1=min(mx1,cnt);
		}
	}
	//cout<<mx1<<" "<<mx2<<"\n";
	ll ans=0;
	for(int i=1;i<=mx1;i++)
	{
		for(int j=1;j<=mx2;j++)
		{
			ans=max(ans,i*j);
		}
	}
	cout<<ans;
}
int main()
{
	//freopen("INPUT.txt","r",stdin);
	//freopen("OUTPUT.txt","w",stdout);

	ios_base::sync_with_stdio();
    cin.tie(NULL);
    cout.tie(NULL);

    ll test=1;
	//cin>>test;
    for(int pos=1;pos<=test;pos++)
    	anomalous_solve();
}

Compilation message

bomb.cpp: In function 'void anomalous_solve()':
bomb.cpp:61:19: error: no matching function for call to 'max(long long int&, int)'
   61 |    ans=max(ans,i*j);
      |                   ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from bomb.cpp:4:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
bomb.cpp:61:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   61 |    ans=max(ans,i*j);
      |                   ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from bomb.cpp:4:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
bomb.cpp:61:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   61 |    ans=max(ans,i*j);
      |                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bomb.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
bomb.cpp:61:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   61 |    ans=max(ans,i*j);
      |                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bomb.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
bomb.cpp:61:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   61 |    ans=max(ans,i*j);
      |                   ^