37962023-03-02 22:33:07Erik_GepardBimmbamm (30)cpp17Accepted 30/303ms3868 KiB
#include<bits/stdc++.h>
using namespace std;

void solve(){
    int n;
    cin>>n;
    for(int i=1; i<=n; i++){
        string s;
        cin>>s;
        if((i%3==0 && i%5!=0 && s=="BIMM") || (i%3!=0 && i%5==0 && s=="BAMM") || (i%3==0 && i%5==0 && s=="BUMM") || (i%3!=0 && i%5!=0 && s=="SZAM")){
            continue;
        }
        else{
            cout<<i<<"\n";
            return;
        }
    }
    cout<<"0\n";
    return;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1832 KiB
2Accepted0/02ms2052 KiB
3Accepted3/33ms2284 KiB
4Accepted3/32ms2468 KiB
5Accepted3/33ms2684 KiB
6Accepted3/33ms2904 KiB
7Accepted3/33ms3260 KiB
8Accepted3/33ms3256 KiB
9Accepted3/33ms3476 KiB
10Accepted3/32ms3560 KiB
11Accepted3/33ms3788 KiB
12Accepted3/33ms3868 KiB