Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define ll long long
#define endl '\n'
#define gap " "
#define bug(a) cerr<<#a<<":"<<a<<endl;
#define gcd __gcd(a,b)
#define lcm (a*b)/(__gcd(a,b))
#define pb push_back
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
const double pi=acos(-1);
const ll mod=1000000007;
#define tc ll t;cin>>t;while(t--)
int main()
{
optimize()
tc
{
ll n,m;
cin>>n>>m;
char arr[n][m];
ll i,j,k,l,n1,n2;
vector<ll>v(n);
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
cin>>arr[i][j];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(arr[i][j]=='+')
{
ll c1=0;
for(k=i+1, l=i-1, n1=j+1, n2=j-1;k<n,l>=0, n1<m, n2>=0;k++, l++, n1++, n2++)
{
if(arr[k][j]!='+')
{
break;
}
if(arr[l][j]!='+')
{
break;
}
if(arr[i][n1]!='+')
{
break;
}
if(arr[i][n2]!='+')
{
break;
}
c1++;
}
v.pb(1+(c1*4));
}
}
}
sort(rall(v));
cout<<v[0]<<endl;
}
}
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 06:17:22
- Judged At
- 2024-12-09 06:17:22
- Judged By
- Score
- 2
- Total Time
- 23ms
- Peak Memory
- 604.0 KiB