17972022-12-03 18:34:28kovacs.peter.18fBimmbamm (30)cpp11Accepted 30/303ms3780 KiB
#include <iostream>
#include <vector>
#include <string>

using namespace std;

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

    int N, answer = 0;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        string s;
        cin >> s;
        if (i % 3 == 0 && i % 5 == 0) {
            if (s != "BUMM" && !answer) {
                answer = i;
            }
        }
        else if (i % 5 == 0) {
            if (s != "BAMM" && !answer) {
                answer = i;
            }
        }
        else if (i % 3 == 0) {
            if (s != "BIMM" && !answer) {
                answer = i;
            }
        }
        else if (s != "SZAM" && !answer) {
            answer = i;
        }
    }
    cout << answer << '\n';
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1832 KiB
2Accepted0/02ms2028 KiB
3Accepted3/32ms2224 KiB
4Accepted3/32ms2428 KiB
5Accepted3/32ms2528 KiB
6Accepted3/32ms2736 KiB
7Accepted3/32ms2964 KiB
8Accepted3/32ms3168 KiB
9Accepted3/32ms3372 KiB
10Accepted3/32ms3580 KiB
11Accepted3/32ms3660 KiB
12Accepted3/32ms3780 KiB