37602023-03-02 20:43:27hackemonBimmbamm (30)cpp17Elfogadva 30/303ms3444 KiB
#include <bits/stdc++.h>
using namespace std;
//using namespace std::chrono;

#define pii pair<int,int>
#define pb push_back
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vvi vector<vi>
#define vvb vector<vb>
#define vvl vector<vl>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define fScan {ios_base::sync_with_stdio(false); cin.tie(NULL);}
#define rep(i, a, b) for(int i = a; i < (b); i++)
#define REP(i, n) for(int i = 0;i <(n); i++)
using ll = long long;
using ld = long double;
ll mod = 1000000007;

const char ny =  '\n';

bool prime(ll a) {
    if (a==1) return 0;
    for (int i=2;i*i<=a;++i)
    {
        if (a%i==0) return 0;
    }
    return 1;
}

ll gcd(ll a,ll b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

ll min(int a, ll b) {
    if(a< b) return a;
    else return b;
}


    void solve() { 
    int n;
    cin >> n;
    vector<string> k(n);
    int ans = 0;
    for(int i = 0;i< n;i++ ) cin >> k[i];

    for(int i = 1;i<= n;i++ ) {
        if(i%15 == 0) {
            if(k[i-1] != "BUMM") {
            cout << i << endl;
            return;
            }
        } else if(i%3 == 0) {
            if(k[i-1] != "BIMM") {
            cout << i << endl;
            return;
            }
        } else if(i%5 == 0) {
            if(k[i-1] != "BAMM") {
            cout << i << endl;
            return;
            }
        } else {
            if(k[i-1] != "SZAM") {
                cout << i << endl;
                return;
            }
        }
    }
    cout << 0 << endl;
    }


int main()
{
    fScan

    int t = 1;
    //comment out if necessary
    //cin>> t;


    //auto start = high_resolution_clock::now();
    while(t-- ) {
        solve();
    }
    //auto end = high_resolution_clock::now();
    //auto dur = duration_cast<milliseconds>(end-start);
    //cout<< "runtime: " << dur.count() << " milliseconds" << '\n';
    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base30/30
1Elfogadva0/03ms1824 KiB
2Elfogadva0/03ms2196 KiB
3Elfogadva3/32ms2120 KiB
4Elfogadva3/33ms2400 KiB
5Elfogadva3/33ms2504 KiB
6Elfogadva3/32ms2592 KiB
7Elfogadva3/32ms2588 KiB
8Elfogadva3/33ms2804 KiB
9Elfogadva3/32ms2912 KiB
10Elfogadva3/33ms3272 KiB
11Elfogadva3/32ms3228 KiB
12Elfogadva3/33ms3444 KiB