/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 8ms 540.0 KiB
#3 Accepted 12ms 796.0 KiB
#4 Accepted 21ms 580.0 KiB
#5 Accepted 17ms 584.0 KiB
#6 Accepted 14ms 540.0 KiB
#7 Accepted 113ms 568.0 KiB
#8 Accepted 41ms 572.0 KiB
#9 Accepted 38ms 540.0 KiB
#10 Accepted 25ms 540.0 KiB
#11 Accepted 230ms 668.0 KiB
#12 Accepted 479ms 1.535 MiB
#13 Accepted 16ms 1.77 MiB
#14 Accepted 15ms 1.527 MiB
#15 Accepted 27ms 1.527 MiB
#16 Accepted 15ms 1.527 MiB
#17 Accepted 25ms 1.32 MiB
#18 Accepted 474ms 1.535 MiB
#19 Accepted 20ms 1.504 MiB
#20 Accepted 403ms 1.531 MiB
#21 Time Exceeded ≥2095ms ≥4.527 MiB
#22 Accepted 136ms 4.277 MiB
#23 Accepted 143ms 4.277 MiB
#24 Accepted 154ms 4.277 MiB
#25 Accepted 95ms 4.449 MiB
#26 Accepted 646ms 4.5 MiB
#27 Accepted 150ms 4.277 MiB
#28 Accepted 120ms 4.527 MiB
#29 Accepted 1076ms 4.527 MiB
#30 Accepted 1462ms 4.504 MiB

Code

// Author: Mushfiq R.
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define ld long double
#define ull unsigned long long
#define vsort(v) sort(v.begin(), v.end())
#define rsort(v) sort(v.begin(), v.end(), greater<int>())
#define fastIO() (ios_base::sync_with_stdio(false), cin.tie(NULL));
using namespace std;

int main()
{
    fastIO();
    int t;
    cin >> t;
    while (t--)
    {
        int row, column;
        cin >> row >> column;
        vector<vector<char>> grid(row, vector<char>(column));
        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < column; j++)
            {
                cin >> grid[i][j];
            }
        }

        int maxx = 0;
        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < column; j++)
            {
                if (grid[i][j] == '+')
                {
                    int count = 1;
                    int d = 1;
                    while (true)
                    {
                        if (i + d < row && j + d < column && i - d >= 0 && j - d >= 0 &&
                            grid[i + d][j] == '+' && grid[i][j + d] == '+' && grid[i - d][j] == '+' && grid[i][j - d] == '+')
                        {
                            count += 4;
                            d++;
                        }
                        else
                        {
                            break;
                        }
                    }
                    maxx = max(maxx, count);
                }
            }
        }

        cout << maxx << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1143 Plus of Pluses
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-11 15:19:46
Judged At
2024-12-11 15:19:46
Judged By
Score
96
Total Time
≥2095ms
Peak Memory
≥4.527 MiB