181752025-10-09 19:05:35zsombBimmbamm (30)cpp17Accepted 30/301ms636 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n; cin >> n;

    for(int i = 1; i < n+1; i++){
        string a;
        cin >> a;
        bool b = false;

        if(i%3 == 0 && i%5 != 0)
            if(a != "BIMM") b= true;
        if(i%3 != 0 && i%5 == 0)
            if(a != "BAMM") b= true;
        if(i%3 == 0 && i%5 == 0)
            if(a != "BUMM") b= true;
        if(i%3 != 0 && i%5 != 0)
            if(a != "SZAM") b= true;

        if(b){
            cout << i;
            return 0;
        }
    }    
    cout << 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/01ms496 KiB
2Accepted0/01ms508 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms316 KiB
5Accepted3/31ms316 KiB
6Accepted3/31ms636 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms316 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB