/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 332.0 KiB
#2 Wrong Answer 2ms 332.0 KiB

Code

/*
Bismillahir Rahmanir Rahim
(In the name of Allah)

@Author Muhammad Nadim
*/

#include<bits/stdc++.h>
using namespace std;

#define     ll              long long
#define     ld              long double
#define     nl              '\n'
#define     pi              acos(-1.0)
#define     sp(n)           fixed<<setprecision(n)
#define     MNTDH_18        ios_base::sync_with_stdio(false); cin.tie(NULL);
#define     yes             cout<<"YES"<<"\n"
#define     no              cout<<"NO"<<"\n"
#define     all(v)          v.begin(), v.end()
#define     CheckBit(x, k)  (x & (1LL << k))
#define     SetBit(x, k)    (x |= (1LL << k))
#define     ClearBit(x, k)  (x &= ~(1LL << k))
#define     LSB(mask)       __builtin_ctzll(mask)
#define     MSB(mask)       63-__builtin_clzll(mask) 

template <typename T, typename U> T ceil(T x, U y) {return (x > 0 ? (x + y - 1) / y : x / y);}
template <typename T, typename U> T floor(T x, U y) {return (x > 0 ? x / y : (x - y + 1) / y);}

//typedef  __int128 lll;
typedef struct rafi
{
    ll type;
    ll idx1;
    ll idx2;
}R;

typedef struct sajeeb
{
    ll val1;
    ll val2;
}S;

typedef struct ohi
{
    ll l;
    ll r;
    ll u;
    ll d;
    int val;
}O;

const int N=2e5+7, M=1073741824, N1=60;

void sF()
{
    ll n, e=0, m=0, q=0, cntE=0, cntM=0, cntQ=0;
    cin>>n;

    string s;
    cin>>s;

    for(int i=0; i<n; i++)
    {
        if(s[i]=='E')   cntE++;
        else
        {
            if(cntE>1)  e+=(2*cntE);
            else    e+=cntE;

            cntE=0;
        }
    }

    if(cntE>1)  e+=(2*cntE);
    else    e+=cntE;

    for(int i=0; i<n; i++)
    {
        if(s[i]=='M')  cntM++;
        else
        {
            if(cntM>1)  m+=(2*cntM);
            else    m+=cntM;

            cntM=0;
        }
    }

    if(cntM>1)  m+=(2*cntM);
    else    m+=cntM;

    for(int i=0; i<n; i++)
    {
        if(s[i]=='?')  cntQ++;
        else
        {
            if(cntQ>1)  q+=(2*cntQ);
            else    q+=cntQ;

            cntQ=0;
        }
    }

    if(cntQ>1)  q+=(2*cntQ);
    else    q+=cntQ;

    if(e==m)    cout<<"IDK";
    else if(e>m)
    {
        if(m+q<e)   cout<<"Emon";
        else    cout<<"IDK";
    }
    else
    {
        if(e+q<m)   cout<<"Mahfuz";
        else    cout<<"IDK";
    }

    //cout<<nl<<e<<" "<<m<<" "<<q;
}

int main()
{
    MNTDH_18
    //pow2();

    int tc=1, cs=1;
    //cin>>tc;
    
    while(tc--)
    {
        //cout<<"Case "<<cs++<<": ";
        sF();
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1031 Clash of programmers
Language
C++17 (G++ 13.2.0)
Submit At
2024-03-09 05:51:27
Judged At
2024-11-11 03:41:04
Judged By
Score
0
Total Time
2ms
Peak Memory
332.0 KiB