/ SeriousOJ /

Record Detail

Wrong Answer


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

Code

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tc=1,tc1=1;
    cin>>tc;
    up:
    while(tc--){
      ll n,m;
      cin>>n>>m;
      char s[n][m];
      for(ll i=0;i<n;i++){
        for(ll j=0;j<m;j++){
          cin>>s[i][j];
        }
      }
      ll l[n][m],r[n][m],u[n][m],d[n][m],g=0;
      for(ll i=0;i<n;i++){
        ll c=0;
        for(ll j=0;j<m;j++){
          if(s[i][j]=='+'){
            c++;
            g=1;
          }
          else {
            c=0;
          }
          l[i][j]=c;
        }
      }
      for(ll i=0;i<n;i++){
        ll c=0;
        for(ll j=m-1;j>=0;j--){
          if(s[i][j]=='+'){
            c++;
          }
          else {
            c=0;
          }
          r[i][j]=c;
        }
      }
      for(ll i=0;i<m;i++){
        ll c=0;
        for(ll j=0;j<n;j++){
          if(s[j][i]=='+'){
            c++;
          }
          else {
            c=0;
          }
          u[j][i]=c;
        }
      }
      for(ll i=m-1;i>=0;i--){
        ll c=0;
        for(ll j=n-1;j>=0;j--){
          if(s[j][i]=='+'){
            c++;
          }
          else {
            c=0;
          }
          d[j][i]=c;
        }
      }
      ll mx=g;
      for(ll i=1;i<n-1;i++){
        for(ll j=1;j<m-1;j++){
          if(s[i][j]=='-'){
            continue;
          }
          ll mn=min({l[i][j-1],r[i][j+1],d[i+1][j],u[i][j-1]});
          mx=max(mx,mn*4+1);
        }
      }
      cout<<mx<<'\n';
    }
}

Information

Submit By
Type
Submission
Problem
P1143 Plus of Pluses
Contest
LU IUJPC : Sylhet Division 2024 Replay Contest
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-10 10:27:58
Judged At
2024-12-10 10:27:58
Judged By
Score
2
Total Time
11ms
Peak Memory
796.0 KiB