Submission #1013953

# Submission time Handle Problem Language Result Execution time Memory
1013953 2024-07-04T08:40:25 Z May27_th Marko (COCI15_marko) C++17
50 / 50
7 ms 1052 KB
#include<bits/stdc++.h>
using namespace std;
#define i64 long long
#define i128 __int128
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
void Solve(void) {
  map<char, int> mp; 
  for (int i = 0; i < 15; i ++) {
    mp[char(i + 'a')] = i/3 + 2;
  }
  for (int i = 15; i <= 18; i ++) {
    mp[char(i + 'a')] = 7; 
  }
  for (int i = 19; i <= 21; i ++) {
    mp[char(i + 'a')] = 8;
  }
  for (int i = 22; i <= 25; i ++) {
    mp[char(i + 'a')] = 9;
  }
  int N; cin >> N;
  vector<string> S(N);
  for (int i = 0; i < N; i ++) {
    cin >> S[i];
  }
  string pressed; cin >> pressed;
  int ans = 0;
  for (int i = 0; i < N; i ++) {
    if ((int)pressed.size() != (int)S[i].size()) continue;
    bool flag = true;
    for (int j = 0; j < (int)S[i].size(); j ++) {
      // cout << mp[S[i][j]] << " " << pressed[j] - '0' << "\n";
      if (mp[S[i][j]] != pressed[j] - '0') {
        flag = false;
      }
    }
    ans += flag;
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(10);
  int Tests = 1; // cin >> Tests;
  while (Tests --) {
    Solve();
  }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 7 ms 860 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 7 ms 1052 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 5 ms 860 KB Output is correct