7442022-01-04 13:23:08Valaki2Bimmbamm (30)cpp14Accepted 30/302ms1988 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second

string jo(int x) {
    int res = 0;
    if(x % 3 == 0 && x % 5 == 0) return "BUMM";
    if(x % 3 == 0) return "BIMM";
    if(x % 5 == 0) return "BAMM";
    return "SZAM";
}

void solve() {
    int n;
    cin >> n;
    vector<string> v(1 + n, "");
    for(int i = 1; i <= n; i++) {
        cin >> v[i];
        if(v[i] != jo(i)) {
            cout << i << "\n";
            return;
        }
    }
    cout << "0\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // int T = 1; cin >> T; while(T--)// !!!!!
    solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/02ms1760 KiB
2Accepted0/01ms1896 KiB
3Accepted3/31ms1904 KiB
4Accepted3/31ms1900 KiB
5Accepted3/32ms1912 KiB
6Accepted3/31ms1920 KiB
7Accepted3/31ms1920 KiB
8Accepted3/31ms1940 KiB
9Accepted3/31ms1944 KiB
10Accepted3/31ms1960 KiB
11Accepted3/31ms1976 KiB
12Accepted3/32ms1988 KiB