202252026-01-05 15:46:00pirosmacska10Bimmbamm (30)cpp17Accepted 30/301ms508 KiB
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<cmath>


using namespace std;
using ll = long long;


#define endl '\n' 


const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    int first = 0;
    for (int i = 1; i <= n; i++) {
        string s;
        cin >> s;
        if (i % 3 == 0) {
            if (i % 5 == 0) {
                if (s != "BUMM") {
                    first = i;
                    break;
                }
            }
            else {
                if (s != "BIMM") {
                    first = i;
                    break;
                }
            }
        }
        else if (i % 5 == 0) {
            if (s != "BAMM") {
                first = i;
                break;
            }
        }
        else if (s != "SZAM") {
            first = i;
            break;
        }
    }
    cout << first << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms316 KiB
5Accepted3/31ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms508 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB