78292024-01-11 12:27:32TundeBimmbamm (30)cpp17Accepted 30/303ms3604 KiB
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string t[n];
    int x=0, q=0;
    string u1="BIMM", u2="BAMM", u3="BUMM", u4="SZAM", u;
    for(int i=0; i<n; i++)
    {
        cin >> t[i];
        q++;
        if(q%3==0)
        {
            if(q%5==0)
            {
                u=u3;
            }
            else
            {
                u=u1;
            }
        }
        else
        {
            if(q%5==0)
            {
                u=u2;
            }
            else
            {
                u=u4;
            }
        }
        if(t[i]!=u && x==0)
        {
            x=i+1;
        }
    }
    cout << x;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1808 KiB
2Accepted0/03ms2160 KiB
3Accepted3/33ms2216 KiB
4Accepted3/33ms2428 KiB
5Accepted3/33ms2512 KiB
6Accepted3/33ms2512 KiB
7Accepted3/33ms2756 KiB
8Accepted3/33ms2976 KiB
9Accepted3/33ms3188 KiB
10Accepted3/33ms3448 KiB
11Accepted3/33ms3516 KiB
12Accepted3/33ms3604 KiB