Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll tc;
cin>>tc;
while(tc--)
{
ll n,m;
cin>>n>>m;
char ar[n][m];
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>ar[i][j];
}
}
ll mx=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(ar[i][j]=='+')
{
ll c=1;
ll l=i-1;
ll r=j;
while(l>=0)
{
if(ar[l][r]=='+')
c++;
else
break;
l--;
}
l=i+1;
r=j;
while(l<n)
{
if(ar[l][r]=='+')
c++;
else
break;
l++;
}
l=i;
r=j-1;
while(r>=0)
{
if(ar[l][r]=='+')
c++;
else
break;
r--;
}
l=i;
r=j+1;
while(r<m)
{
if(ar[l][r]=='+')
c++;
else
break;
r++;
}
mx=max(mx,c);
}
}
}
cout<<mx<<endl;
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1143 Plus of Pluses
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-12-12 05:31:52
- Judged At
- 2024-12-12 05:31:52
- Judged By
- Score
- 2
- Total Time
- 62ms
- Peak Memory
- 540.0 KiB