108562024-04-17 07:39:53VargusBimmbamm (30)cpp17Accepted 30/303ms3780 KiB
#include <iostream>
#include <string>
#include <queue>
#define ll long long

using namespace std;

int main()
{
    ll n;
    cin >> n;
    vector <string> s(n + 1);
    for (ll i = 1; i <= n; ++i)
    {
        cin >> s[i];
    }
    for (ll i = 1; i <= n; ++i)
    {
        if (i % 3 == 0 && i % 5 == 0)
        {
            if (s[i] != "BUMM")
            {
                cout << i;
                return 0;
            }
        }
        else if (i % 3 == 0)
        {
            if (s[i] != "BIMM")
            {
                cout << i;
                return 0;
            }
        }
        else if (i % 5 == 0)
        {
            if (s[i] != "BAMM")
            {
                cout << i;
                return 0;
            }
        }
        else if (s[i] != "SZAM")
        {
            cout << i;
            return 0;
        }
    }

    return 0;
}
/*
4
SZAM
SZAM
BIMM
BIMM

5
SZAM
SZAM
BAMM
SZAM
SZAM
*/
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1808 KiB
2Accepted0/03ms2096 KiB
3Accepted3/33ms2160 KiB
4Accepted3/33ms2376 KiB
5Accepted3/33ms2596 KiB
6Accepted3/33ms2684 KiB
7Accepted3/33ms2728 KiB
8Accepted3/33ms2976 KiB
9Accepted3/33ms3160 KiB
10Accepted3/33ms3256 KiB
11Accepted3/33ms3616 KiB
12Accepted3/33ms3780 KiB