/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 7ms 788.0 KiB
#3 Wrong Answer 11ms 540.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define bug(a) cout << #a << " : " << a << '\n';

void solve(int cs){
	int n,m;cin >> n >>m;
	char arr[n+1][m+1];
	bool ok = false;
	for (int i = 0; i < n; ++i)
	{
		for(int j = 0;j < m ; ++j){
			cin >> arr[i][j];
			if(arr[i][j] == '+')ok = true;
		}	

	}
	if(ok == false){
		cout << 0 << '\n';
		return;
	}
	int a ,b,c,d,cnt = 1;
	int mx = INT_MIN;
	for (int i = 0; i < n; ++i)
	{
		for(int j = 0;j < m ; ++j){
			if(arr[i][j] == '+'){
				a= i-1;
				b = j+1;
				c = i +1;
				d = j-1;
				while(arr[a][j] == '+' and arr[i][b] == '+' 
					and arr[c][j] == '+' and arr[i][d] == '+'){
					a--;
					b++;
					c++;
					d--;
					cnt += 4;
				}

				mx = max(cnt,mx);
				cnt = 1;

			}
		}	

	}
		cout << mx << '\n';




}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);


    int t; cin>>t;
    int cs = 0;
    while(t--){
        solve(++cs);
    }
    
    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 08:12:39
Judged At
2024-12-09 08:12:39
Judged By
Score
2
Total Time
11ms
Peak Memory
788.0 KiB