64162023-11-28 18:50:09antiBimmbamm (30)cpp14Accepted 30/303ms3320 KiB
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<string> B;
    
    for (int i = 0; i < n; i++) {
        string a;
        cin >> a;
        B.push_back(a);
    }
    bool hiba = false;
    int megoldas = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0 and i % 5 == 0 and B[i-1] != "BUMM")
            hiba = true;
        if (i % 3 == 0 and i % 5 != 0 and B[i-1] != "BIMM")
            hiba = true;
        if (i % 3 != 0 and i % 5 == 0 and B[i-1] != "BAMM")
            hiba = true;
        if (i % 3 != 0 and i % 5 != 0 and B[i-1] != "SZAM")
            hiba = true;
        if (hiba) {
            megoldas = i;
            break;
        }
    }
    cout << megoldas << endl;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1812 KiB
2Accepted0/03ms2248 KiB
3Accepted3/33ms2276 KiB
4Accepted3/33ms2484 KiB
5Accepted3/33ms2576 KiB
6Accepted3/33ms2708 KiB
7Accepted3/33ms2784 KiB
8Accepted3/33ms2928 KiB
9Accepted3/33ms3288 KiB
10Accepted3/33ms3060 KiB
11Accepted3/33ms3060 KiB
12Accepted3/33ms3320 KiB