/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Wrong Answer 5ms 540.0 KiB
#3 Wrong Answer 6ms 772.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(){
   int 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];
        }
    }
    int sumr=0, r=0;
    int sumc=0, c=0;
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            if(grid[i][j]=='+') r++;
        }
        sumr=max(sumr, r); 
        r=0;
    }
    for(int 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 08:06:59
Judged At
2024-12-09 08:06:59
Judged By
Score
2
Total Time
6ms
Peak Memory
772.0 KiB