Submission #542511

# Submission time Handle Problem Language Result Execution time Memory
542511 2022-03-26T19:47:32 Z Olympia Marko (COCI15_marko) C++17
50 / 50
6 ms 1368 KB
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <random>
#include <cassert>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <limits.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vector<string> vec(N);
    for (int i = 0; i < N; i++) {
        cin >> vec[i];
    }
    string s;
    cin >> s;
    set<int> id[10];
    id[2] = {'a', 'b', 'c'};
    id[3] = {'d', 'e', 'f'};
    id[4] = {'g', 'h', 'i'};
    id[5] = {'j', 'k', 'l'};
    id[6] = {'m', 'n', 'o'};
    id[7] = {'p', 'q', 'r', 's'};
    id[8] = {'t', 'u', 'v'};
    id[9] = {'w', 'x', 'y', 'z'};
    int c = 0;
    for (int i = 0; i < N; i++) {
        if (vec[i].size() != s.size()) {
            continue;
        }
        bool f = true;
        for (int j = 0; j < vec[i].size(); j++) {
            if (!id[(int)(s[j] - '0')].count(vec[i][j])) {
                f = false;
            }
        }
        c += f;
    }
    cout << c;
}

Compilation message

marko.cpp: In function 'int main()':
marko.cpp:40:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for (int j = 0; j < vec[i].size(); j++) {
      |                         ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 6 ms 1368 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 464 KB Output is correct
7 Correct 2 ms 852 KB Output is correct
8 Correct 6 ms 1360 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 5 ms 980 KB Output is correct