/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 7ms 1.168 MiB
#3 Wrong Answer 10ms 1.027 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 && i <= n && j >= 1 && j <= 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:53:17
Judged At
2024-12-09 06:53:17
Judged By
Score
2
Total Time
10ms
Peak Memory
1.168 MiB