/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 584.0 KiB
#2 Accepted 8ms 540.0 KiB
#3 Accepted 16ms 728.0 KiB
#4 Accepted 18ms 796.0 KiB
#5 Accepted 16ms 736.0 KiB
#6 Accepted 17ms 856.0 KiB
#7 Accepted 78ms 760.0 KiB
#8 Accepted 28ms 844.0 KiB
#9 Accepted 34ms 1.277 MiB
#10 Accepted 43ms 1.398 MiB
#11 Accepted 218ms 2.184 MiB
#12 Accepted 798ms 9.441 MiB
#13 Accepted 43ms 5.484 MiB
#14 Accepted 27ms 1.512 MiB
#15 Accepted 43ms 5.426 MiB
#16 Accepted 25ms 1.508 MiB
#17 Accepted 26ms 1.508 MiB
#18 Accepted 588ms 9.41 MiB
#19 Accepted 23ms 3.621 MiB
#20 Accepted 482ms 9.469 MiB
#21 Time Exceeded ≥2098ms ≥35.953 MiB
#22 Accepted 201ms 36.176 MiB
#23 Accepted 249ms 36.16 MiB
#24 Runtime Error 142ms 36.012 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;
        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