Submission #292457

# Submission time Handle Problem Language Result Execution time Memory
292457 2020-09-07T04:18:57 Z 7_7_7 Marko (COCI15_marko) C++17
50 / 50
8 ms 1536 KB
#include <bits/stdc++.h>

using namespace std;

int n;
int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n;
    vector<string> a(n);
    for(auto &x: a) cin >> x;

    set<char> c[10];
    c[2] = {'a', 'b', 'c'};
    c[3] = {'d', 'e', 'f'};
    c[4] = {'g', 'h', 'i'};
    c[5] = {'j', 'k', 'l'};
    c[6] = {'m', 'n', 'o'};
    c[7] = {'p', 'q', 'r', 's'};
    c[8] = {'t', 'u', 'v'};
    c[9] = {'w', 'x', 'y', 'z'};
    string s;
    cin >> s;
    int cnt = 0;
    for(int i = 0; i < n; i ++){
        int pos = 0;
        if((int)a[i].size() != (int)s.size()) continue;
        for(int j = 0; j < (int)s.size(); j ++){
            if(c[(s[j] - '0')].count(a[i][j]) == 0) break;
            pos ++;
        }
        if(pos == (int)a[i].size()) cnt ++;
    }
    cout << cnt << "\n";
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 7 ms 1408 KB Output is correct
5 Correct 1 ms 512 KB Output is correct
6 Correct 1 ms 512 KB Output is correct
7 Correct 2 ms 896 KB Output is correct
8 Correct 8 ms 1536 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 6 ms 1152 KB Output is correct