/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 1.086 MiB
#2 Wrong Answer 8ms 1.324 MiB
#3 Wrong Answer 14ms 1.277 MiB

Code

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define MOD 1000000007
#define pie 2 * (acos(0.0))
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define pb push_back
#define nl '\n'
#define lcm(a, b) (a * b) / (__gcd<ll>(a, b))
#define print(v)          \
    for (auto e : v)      \
        cout << e << " "; \
    cout << endl;
#define printp(v)    \
    for (auto e : v) \
        cout << e.first << " " << e.second << endl;
#define srt(v) sort(v.begin(), v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define trav(a, x) for (auto &a : x)
#define F first
#define S second
#define setbit(x) __builtin_popcount(x)
#define sz(x) (int)(x).size()
#define vi vector<int>
#define pi pair<int, int>
#define even(n) if (n % 2 == 0)
#define odd(n) if (n % 2 == 1)
#define sp << " " <<

#define alliswell                \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);

const int mx = 1e5+100;
vector<int>ar(mx, 5);
vector<int> pfs (mx, 5);


void solve()
{
    int n , m;
    cin >> n >> m;
    int mx = 0;

    char s[n+10][m+10];

    for(int i = 0; i < n; i++){
       for(int j = 0; j < m ; j++){
            cin >> s[i][j];
       }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < m ; j++){
            if(  s[i][j] == '+'){
                int ans = 1;
                mx = max(mx, ans);

                int k = 1;
                while(1){
                    if(s[i-k][j] == '+' && s[i+k][j] == '+' && s[i][j-k] == '+' && s[i][j+k] == '+' ){
                        ans+=4;
                        mx = max(mx, ans);
                        k++;
                    }
                    else {
                        break;
                    }
                }
            }
        }
    }

    cout << mx << endl;
   // cout << "hey";
    
   
}
int main()
{
    alliswell

    int t; cin  >> t;
    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:46:43
Judged At
2024-12-09 06:46:43
Judged By
Score
2
Total Time
14ms
Peak Memory
1.324 MiB