/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 584.0 KiB
#2 Accepted 7ms 568.0 KiB
#3 Accepted 13ms 540.0 KiB
#4 Accepted 16ms 796.0 KiB
#5 Accepted 11ms 540.0 KiB
#6 Accepted 16ms 568.0 KiB
#7 Accepted 80ms 772.0 KiB
#8 Accepted 25ms 540.0 KiB
#9 Accepted 25ms 540.0 KiB
#10 Accepted 26ms 664.0 KiB
#11 Accepted 181ms 876.0 KiB
#12 Accepted 654ms 1.527 MiB
#13 Accepted 17ms 1.277 MiB
#14 Accepted 15ms 1.504 MiB
#15 Accepted 24ms 1.527 MiB
#16 Accepted 14ms 1.277 MiB
#17 Accepted 15ms 1.527 MiB
#18 Accepted 645ms 1.57 MiB
#19 Accepted 19ms 1.293 MiB
#20 Accepted 538ms 1.527 MiB
#21 Time Exceeded ≥2097ms ≥4.527 MiB
#22 Accepted 161ms 4.371 MiB
#23 Accepted 172ms 4.277 MiB
#24 Accepted 172ms 4.473 MiB
#25 Accepted 105ms 4.527 MiB
#26 Accepted 832ms 4.527 MiB
#27 Accepted 176ms 4.527 MiB
#28 Accepted 134ms 4.527 MiB
#29 Accepted 1427ms 4.367 MiB
#30 Accepted 1914ms 4.359 MiB

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;
        ll maxi=0;
        ll cnt=0;
        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]!='+' || 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++;
                    }
                    ll check=(c1*4)+1;
                    maxi=max(check,maxi);
                }
            }
        }
        cout<<maxi<<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:48:36
Judged At
2024-12-09 06:48:36
Judged By
Score
96
Total Time
≥2097ms
Peak Memory
≥4.527 MiB