Runtime Error
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++, l--, n1++, n2--)
{
if(arr[k][j]!='+' || k>=n)
{
break;
}
if(arr[l][j]!='+' || l<0)
{
break;
}
if(arr[i][n1]!='+' || n1>=m)
{
break;
}
if(arr[i][n2]!='+' || n2<0)
{
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:32:10
- Judged At
- 2024-12-09 06:32:10
- Judged By
- Score
- 68
- Total Time
- 2098ms
- Peak Memory
- 36.176 MiB