/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 352.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Runtime Error 2ms 792.0 KiB
#4 Accepted 2ms 580.0 KiB
#5 Wrong Answer 2ms 512.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SORT(v) sort(v.begin(), v.end())
#define REVERSE(v) reverse(v.begin(), v.end())
#define REV_SORT(v) sort((v).begin(), (v).end(), greater<>())
#define vint vector<int>
#define vll vector<ll>
#define vch vector<char>
#define vstr vector<string>
#define u_set unordered_set
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define fast \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0);
using namespace std;

void debug()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}

void solve();

int32_t main()
{
    fast;
    //debug();
    int TestCase = 1;
    // cin >> TestCase;
    while (TestCase--)
        solve();
    return 0;
}

void solve()
{
    int m, n;
    cin >> m >> n;
    int mm[7][m];
    int nn[7][n];


    for (int i = 0; i < 7; i++)
        for (int j = 0; j < m; j++)
            cin >> mm[i][j];

    for (int i = 0; i < 7; i++)
        for (int j = 0; j < n; j++)
            cin >> nn[i][j];

    ll m_sum = 0, n_sum = 0;
    vector<pll> vectm, vectn;
    int m_cnt = 0, n_cnt = 0;

    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < 7; j++)
        {
            if (mm[j][i] != 0)
            {
                m_cnt++;
                m_sum += mm[j][i];
            }
            else
            {
                vectm.pb({m_cnt, m_sum});
                m_cnt = 0;
                m_sum = 0;
            }
        }
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 7; j++)
        {
            if (nn[j][i] != 0)
            {
                n_cnt++;
                n_sum += nn[j][i];
            }
            else
            {
                vectn.pb({n_cnt, n_sum});
                n_cnt = 0;
                n_sum = 0;
            }
        }
    }

    SORT(vectn);
    SORT(vectm);


    if (vectm[vectm.size() - 1].fi > vectn[vectn.size() - 1].fi)
        cout << "Mahfuz is the boss";
    else if (vectm[vectm.size() - 1].fi < vectn[vectn.size() - 1].fi)
        cout << "Nayon is the boss";
    else
    {
        if (vectm[vectm.size() - 1].se > vectn[vectn.size() - 1].se)
            cout << "Mahfuz is the boss";
        else if (vectm[vectm.size() - 1].se < vectn[vectn.size() - 1].se)
            cout << "Nayon is the boss";
        else
            cout << "No one is the boss";
    }
}

Information

Submit By
Type
Submission
Problem
P1017 Solution streak
Contest
Brain booster - 1
Language
C++20 (G++ 13.2.0)
Submit At
2023-12-31 16:59:10
Judged At
2024-11-11 03:44:53
Judged By
Score
30
Total Time
2ms
Peak Memory
792.0 KiB