79162024-01-11 22:43:54adamBimmbamm (30)cpp17Accepted 30/303ms3904 KiB
#include <bits/stdc++.h>

using namespace std;

enum Word {
    bimm,
    bamm,
    bumm,
    szam
};

int main() {
    int length = 0;
    cin >> length;
    vector<Word> words(length, Word::szam);
    for (int i = 0; i < length; i++) {
        string input;
        cin >> input;
        if (input == "BIMM") words[i] = Word::bimm;
        else if (input == "BAMM") words[i] = Word::bamm;
        else if (input == "BUMM") words[i] = Word::bumm;
        else words[i] = Word::szam;
    }
    for (int i = 0; i < length; i++) {
        int j = i+1;
        if (j % 3 != 0 && j % 5 != 0 && words[i] == Word::szam) continue;
        else if (j % 3 == 0 && j % 5 != 0 && words[i] == Word::bimm) continue;
        else if (j % 3 != 0 && j % 5 == 0 && words[i] == Word::bamm) continue;
        else if (j % 3 == 0 && j % 5 == 0 && words[i] == Word::bumm) continue;
        else {
            cout << j << endl;
            break;
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1852 KiB
2Accepted0/03ms2012 KiB
3Accepted3/33ms2228 KiB
4Accepted3/33ms2444 KiB
5Accepted3/33ms2660 KiB
6Accepted3/33ms2744 KiB
7Accepted3/33ms2876 KiB
8Accepted3/33ms3000 KiB
9Accepted3/33ms3200 KiB
10Accepted3/33ms3320 KiB
11Accepted3/33ms3456 KiB
12Accepted3/33ms3904 KiB