/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 348.0 KiB
#3 Accepted 1ms 764.0 KiB
#4 Accepted 2ms 764.0 KiB
#5 Accepted 1ms 324.0 KiB
#6 Accepted 1ms 324.0 KiB
#7 Accepted 1ms 532.0 KiB
#8 Accepted 1ms 532.0 KiB
#9 Accepted 2ms 532.0 KiB
#10 Accepted 2ms 532.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m,n;
    cin>>m>>n;
    int mah[7][m];
    int noy[7][n];
    for(int i=0; i<7; i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>mah[i][j];
        }
    }
    for(int i=0; i<7; i++)
    {
        for(int j=0;j<n;j++)
        {
            cin>>noy[i][j];
        }
    }
    int noyon_st =0;
    int mahfuj_st =0;

    int noy_solve = 0;
    int mah_solve = 0;

    int max_mah_st = 0;
    int max_noy_st = 0;

    int max_mah_solve = 0;
    int max_noy_solve = 0;

    for(int j=0; j<m;j++)
    {
        for(int i=0; i<7; i++)
        {
            if(mah[i][j]>0){
                mahfuj_st++;
                mah_solve += mah[i][j];
                if(mahfuj_st >= max_mah_st)
                {
                    max_mah_st = mahfuj_st;  
                    max_mah_solve = max(max_mah_solve, mah_solve); 
                }
                
            }else{
                mahfuj_st = 0;
                mah_solve = 0;
            }
        }
    }
    for(int j=0; j<n;j++)
    {
        for(int i=0; i<7; i++)
        {
            if(noy[i][j]>0){
                noyon_st++;
                noy_solve += noy[i][j];
                if(noyon_st >= max_noy_st)
                {
                    max_noy_st = noyon_st;  
                    max_noy_solve = max(max_noy_solve,noy_solve); 
                }
                
            }else{
                noyon_st = 0;
                noy_solve = 0;
            }
        }
    }
    if(max_noy_st>max_mah_st)
    {
        cout<<"Nayon is the boss"<<endl;
    }
    else if(max_mah_st>max_noy_st)
    {
        cout<<"Mahfuz is the boss"<<endl;
    }
    else{
        if(max_noy_solve>max_mah_solve)
        {
            cout<<"Nayon is the boss"<<endl;
        }
        else if(max_mah_solve>max_noy_solve)
        {
            cout<<"Mahfuz is the boss"<<endl;
        }
        else
        {
            cout<<"No one is the boss"<<endl;
        }
    }
    return 0;

}

Information

Submit By
Type
Submission
Problem
P1017 Solution streak
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-27 21:49:57
Judged At
2024-11-11 03:36:59
Judged By
Score
100
Total Time
2ms
Peak Memory
764.0 KiB