Submission #292456

# Submission time Handle Problem Language Result Execution time Memory
292456 2020-09-07T02:59:50 Z 7_7_7 Marko (COCI15_marko) C++17
15 / 50
481 ms 65540 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;

    vector<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;
    set<string> res;
    for(int i = 0; i < (int)s.size(); i ++){
        int x = (s[i] - '0');
        if(i == 0){
            for(auto y: c[x]){
                string temp = "";
                temp += y;
                res.insert(temp);
            }
            continue;
        }
        set<string> t;
        for(auto str: res){
            for(auto y: c[x]){
                string temp = str;
                temp += y;
                t.insert(temp);
            }
        }
        res = t;
    }
    int cnt = 0;
    for(auto x: a) cnt += res.count(x);

    cout << cnt << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 10 ms 2816 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Runtime error 380 ms 65536 KB Execution killed with signal 9
5 Runtime error 337 ms 65540 KB Execution killed with signal 9
6 Runtime error 420 ms 65536 KB Execution killed with signal 9
7 Runtime error 465 ms 65540 KB Execution killed with signal 9
8 Runtime error 341 ms 65540 KB Execution killed with signal 9
9 Runtime error 481 ms 65540 KB Execution killed with signal 9
10 Runtime error 464 ms 65540 KB Execution killed with signal 9