29542023-02-05 20:09:13lazingergoBimmbamm (30)cpp17Accepted 30/303ms3368 KiB
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <cctype>
#include <cstdlib>
#include <iomanip>
#include <math.h>


using namespace std;

#define ull unsigned long long
#define ll long long

const int I_INF = INT_MAX;
const ll LL_INF = LLONG_MAX;
const ull ULL_INF = ULLONG_MAX;




void solve()
{
	int n;
	cin >> n;

	string s;
	int hiba=-1;
	for (int i = 1; i <= n; i++)
	{
		cin >> s;
		if (not (i % 3 == 0 && i % 5 !=0 && s == "BIMM" || i % 5 == 0  && i % 3 != 0&& s == "BAMM" || i % 3 == 0 && i % 5 == 0 && s == "BUMM" || i % 3 != 0 && i % 5 != 0 && s == "SZAM"))
		{
			hiba = i;
			break;
		}
	}

	if (hiba == -1)
		cout << 0;
	else 
		cout << hiba;



}



int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	solve();
	return 0;
}

SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1812 KiB
2Accepted0/03ms2000 KiB
3Accepted3/33ms2376 KiB
4Accepted3/32ms2376 KiB
5Accepted3/33ms2708 KiB
6Accepted3/32ms2628 KiB
7Accepted3/33ms2756 KiB
8Accepted3/32ms2780 KiB
9Accepted3/32ms2900 KiB
10Accepted3/32ms2980 KiB
11Accepted3/33ms3124 KiB
12Accepted3/33ms3368 KiB