196042025-12-17 08:31:16SzeredaiNatanaelBimmbamm (30)cpp17Accepted 30/302ms500 KiB
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int n; cin >> n;
	bool t = false;
	string s;
	for (int i = 1; i <= n; ++i) {
		cin >> s;
		if (i % 3 == 0) {
			if (i % 5 != 0) {
				if (s == "BIMM") t = true;
				else {
					cout << i << "\n";
					t = false;
					break;
				}
			}
			else {
				if (s == "BUMM") t = true;
				else {
					cout << i << "\n";
					t = false;
					break;
				}
			}
		}
		if (i % 5 == 0) {
			if (i % 3 != 0) {
				if (s == "BAMM") t = true;
				else {
					cout << i << "\n";
					t = false;
					break;
				}
			}
		}
		if (i % 3 != 0 && i % 5 != 0) {
			if (s == "SZAM") t = true;
			else {
				cout << i << "\n";
				t = false;
				break;
			}
		}
	}
	if (t) cout << "0\n";
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/01ms316 KiB
2Accepted0/01ms500 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms316 KiB
5Accepted3/32ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms400 KiB