/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 744.0 KiB
#2 Accepted 7ms 2.777 MiB
#3 Accepted 11ms 1.027 MiB
#4 Accepted 13ms 2.797 MiB
#5 Accepted 11ms 1.059 MiB
#6 Accepted 13ms 796.0 KiB
#7 Accepted 58ms 1.027 MiB
#8 Accepted 24ms 2.527 MiB
#9 Accepted 24ms 4.859 MiB
#10 Accepted 23ms 3.027 MiB
#11 Accepted 123ms 3.02 MiB
#12 Accepted 458ms 9.473 MiB
#13 Accepted 19ms 10.648 MiB
#14 Accepted 17ms 10.73 MiB
#15 Accepted 19ms 11.199 MiB
#16 Accepted 17ms 11.062 MiB
#17 Accepted 17ms 11.094 MiB
#18 Accepted 449ms 9.418 MiB
#19 Accepted 21ms 9.348 MiB
#20 Accepted 385ms 10.629 MiB
#21 Time Exceeded ≥2099ms ≥21.02 MiB
#22 Accepted 132ms 19.27 MiB
#23 Accepted 136ms 21.145 MiB
#24 Accepted 134ms 19.535 MiB
#25 Accepted 89ms 19.77 MiB
#26 Accepted 590ms 20.941 MiB
#27 Accepted 155ms 21.047 MiB
#28 Accepted 123ms 21.32 MiB
#29 Accepted 1009ms 20.789 MiB
#30 Accepted 1379ms 19.785 MiB

Code

#include<bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define print(v) for(auto data : v) cout << data << " "; cout << endl;
using namespace std;
int n, m;
const int N = 1e4 + 5;
char mat[N][N];
void solve()
{
    cin >> n >> m; 
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            cin >> mat[i][j];
        }
    }
    int mx = 0;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            int temp = 1;
            int cnt = 0;
            if(mat[i][j] == '+')
            {
                while (i-1-cnt >= 1 && i-1-cnt <= n && 
                i+1+cnt >= 1 && i+1+cnt <= n &&
                j-1-cnt >= 1 && j-1-cnt <= m && 
                j+1+cnt >= 1 && j+1+cnt <= m
                && mat[i][j-1-cnt] == '+' && mat[i][j+1+cnt] == '+' &&
                mat[i-1-cnt][j] == '+' && mat[i+1+cnt][j] == '+')
                {
                    cnt++, temp += 4; 
                }
                mx = max(mx, temp);
            }
        }
    }
    cout << mx << endl;
}
int main ()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int t; cin >> t;
    // int t = 1;
    while (t--) solve();
    
    return  0;
}

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:59:47
Judged At
2024-12-09 06:59:47
Judged By
Score
96
Total Time
≥2099ms
Peak Memory
≥21.32 MiB