/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 9ms 368.0 KiB
#3 Wrong Answer 387ms 556.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n,m; cin>>n>>m;
	char a[n][m];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>a[i][j];
		}
	}
	
	int ans = 0;
	int mx = 0;
	int f = 0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			int p = 1;
			if(a[i][j]=='+')
			{   
				int ii = i;
				int jj = j;

				f = 1;
				int nw =0;
				
				while(true)
				{
					// cout<<i<<' '<<j<<'\n';
					// mx = 1;
			   
			        for(int k=j+1;j<m;k++)
			       {
			    	if(a[i][k]=='+') nw++;
			    	else break;
			       }
			       // cout<<i<<' '<<j<<'\n';
			    
                   if(nw<p) break;
			       nw = 0;
			       for(int k = i+1;k<n;k++)
			        {
			    	if(a[k][j]=='+') nw++;
			    	else break;
			        }
			        if(nw<p) break;
			        nw = 0;
			        for(int k = j-1;k>=0 ; k--)
			        {
			    	   if(a[i][k]=='+') nw++;
			    	   else break;
			        }
			        if(nw<p) break;
			        nw = 0;
			        for(int k = i-1;k>=0;k--)
			        {
			    	    if(a[k][j]=='+') nw++;
			    	     else break;
			        }
			    
			        if(nw<p) break;
			       
			         ans = max(ans,4*p+1);
				     p++;
			      }
				
				
				
			    

			 }
		}
	}

	cout<<max(ans,f)<<endl;
}
int32_t main()
{
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
    int t; cin>>t;
    while(t--)
    {
    	solve();
    }
	return 0;
}

Information

Submit By
Type
Submission
Problem
P1143 Plus of Pluses
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 07:59:35
Judged At
2024-12-09 07:59:35
Judged By
Score
2
Total Time
387ms
Peak Memory
556.0 KiB