Submission #1298654

#TimeUsernameProblemLanguageResultExecution timeMemory
1298654tabMarko (COCI15_marko)C++20
50 / 50
17 ms4140 KiB
#include "bits/stdc++.h"
using namespace std;
#define intt int
#define fi first
#define se second

const intt mxN = 1e5 + 5;
const intt LG = 20;
const intt inf = 1e18;  
const intt mod = 10007;

intt n;
vector<string> a(mxN);
map<char,intt> mp;
string press;

void _() {
    cin >> n;
    a.resize(n);
    for(intt i = 0; i < n; i++) {
        cin >> a[i];
    }
    cin >> press;

    intt idx = 2, c = 0;
    for(char i = 'a'; i <= 'z'; i++) {
        if(idx == 7 || idx == 9) {
            if(c != 4) {
                mp[i] = idx;
                c++;
            } else {
                mp[i] = ++idx;
                c = 1;
            }
        } else {
            if(c != 3) {
                mp[i] = idx;
                c++;
            } else {
                mp[i] = ++idx;
                c = 1;
            }
        }
        // cout << i << " " << mp[i] << endl;
    }

    intt ans =0;
    for(intt i = 0; i < n; i++) {
        string c = "";
        for(intt j = 0; j < (intt)a[i].size(); j++) {
            c += (mp[a[i][j]] + '0');
        }
        // cout << c<< endl;
        if(c == press) {
            ans++;
        }
    }
    cout << ans << endl;

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    intt t = 1, buu = 1;
    // cin >> t;
    while(t--){
        // cout << "Case #" << buu++ << ": ";
        _();
    }
}

Compilation message (stderr)

marko.cpp:9:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
    9 | const intt inf = 1e18;
      |                  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...