/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Wrong Answer 9ms 536.0 KiB
#3 Wrong Answer 9ms 328.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define srt(v) sort(v.begin(), v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define pb push_back

void solve(){
   ll n, m;
    cin >> n >> m;
    char grid[n][m];
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin >> grid[i][j];
        }
    }
    ll sumr=0, r=0;
    ll sumc=0, c=0;
    for(ll i=0; i<n; i++){
        for(int j=0; j<m; j++){
            if(grid[i][j]=='+') r++;
        }
        sumr=max(sumr, r); 
        r=0;
    }
    for(ll i=0; i<m; i++){
        for(int j=0; j<n; j++){
            if(grid[j][i]=='+') c++;
        }
        sumc=max(sumc, c); 
        c=0;
    }
    if(sumc+sumr-1>=1){
        cout << sumr+sumc-1 << endl;
    }
    else{
        cout << 0 << endl;
    }
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; cin >> t;
    while(t--){
        solve();
    }
}

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 09:41:14
Judged At
2024-12-09 09:41:14
Judged By
Score
2
Total Time
9ms
Peak Memory
536.0 KiB