Submission #624195

#TimeUsernameProblemLanguageResultExecution timeMemory
624195MilosMilutinovicMarko (COCI15_marko)C++14
50 / 50
18 ms1444 KiB
/** * author: wxhtzdy * created: 07.08.2022 14:13:41 **/ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); map<char, char> key; key['a'] = key['b'] = key['c'] = '2'; key['d'] = key['e'] = key['f'] = '3'; key['g'] = key['h'] = key['i'] = '4'; key['j'] = key['k'] = key['l'] = '5'; key['m'] = key['n'] = key['o'] = '6'; key['p'] = key['q'] = key['r'] = key['s'] = '7'; key['t'] = key['u'] = key['v'] = '8'; key['w'] = key['x'] = key['y'] = key['z'] = '9'; int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) { cin >> s[i]; for (int j = 0; j < (int) s[i].size(); j++) { s[i][j] = key[s[i][j]]; } } sort(s.begin(), s.end()); string str; cin >> str; int L = lower_bound(s.begin(), s.end(), str) - s.begin(); if (L >= n || L < 0 || s[L] != str) { cout << 0 << '\n'; return 0; } str.back() += 1; int R = lower_bound(s.begin(), s.end(), str) - s.begin(); cout << R - L << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...