Submission #294517

#TimeUsernameProblemLanguageResultExecution timeMemory
2945177_7_7Mobitel (COCI14_mobitel)C++17
50 / 50
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; int n; int d; int main() { ios_base::sync_with_stdio(false); vector<int> cnt(10); for(int i = 1; i <= 9; i ++){ int x; cin >> x; cnt[x] = i; } map<char, pair<int, int>> t; t['a'] = {2, 1}, t['b'] = {2, 2}, t['c'] = {2, 3}; t['d'] = {3, 1}, t['e'] = {3, 2}, t['f'] = {3, 3}; t['g'] = {4, 1}, t['h'] = {4, 2}, t['i'] = {4, 3}; t['j'] = {5, 1}, t['k'] = {5, 2}, t['l'] = {5, 3}; t['m'] = {6, 1}, t['n'] = {6, 2}, t['o'] = {6, 3}; t['p'] = {7, 1}, t['q'] = {7, 2}, t['r'] = {7, 3}, t['s'] = {7, 4}; t['t'] = {8, 1}, t['u'] = {8, 2}, t['v'] = {8, 3}; t['w'] = {9, 1}, t['x'] = {9, 2}, t['y'] = {9, 3}, t['z'] = {9, 4}; string s; cin >> s; int last = -1; for(int i = 0; i < (int)s.size(); i ++){ pair<int, int> cur = t[s[i]]; if(cur.first == last) cout << '#'; cout << string(cur.second, cnt[cur.first] + '0'); last = cur.first; } }
#Verdict Execution timeMemoryGrader output
Fetching results...