/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 6ms 540.0 KiB
#3 Wrong Answer 32ms 564.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+j<=m;j++)
		{
			
			if(a[i][j]=='+')
			{   
				f = 1;
				
				int p = 1;
				while( i-p>=0 and j-p>=0)
				{
					int nw =0;
			   
			        for(int k=j+1;k<m;k++)
			        {
			       	     
			       	      
			    	     if(a[i][k]=='+') nw++;
			    	     else break;
			    	     if(nw>=p) break;
			        }

			    
                   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;
			        }

			        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;
			        }
			        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;
			        }
			    
			        if(nw<p) break;
			        // if(p==2)
			        // {
			        // 	cout<<i<<' '<<j<<endl;
			        // }
			        if(ans<((4LL*p)+1))
			        {
			        
				      

				       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 09:03:54
Judged At
2024-12-09 09:03:54
Judged By
Score
2
Total Time
32ms
Peak Memory
564.0 KiB