Submission #729795

#TimeUsernameProblemLanguageResultExecution timeMemory
729795WinterMobitel (COCI14_mobitel)C++17
50 / 50
1 ms324 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #pragma GCC optimize("O3") #pragma GCC target("avx,avx2") int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); map<int, int> m; for(int i = 1; i<=9; i++){ int x; cin >> x; m[x]=i; } string s; cin >> s; map<char, pair<int, int>> M; M['a']={2,1}; M['b']={2,2}; M['c']={2,3}; M['d']={3,1}; M['e']={3,2}; M['f']={3,3}; M['g']={4,1}; M['h']={4,2}; M['i']={4,3}; M['j']={5,1}; M['k']={5,2}; M['l']={5,3}; M['m']={6,1}; M['n']={6,2}; M['o']={6,3}; M['p']={7,1}; M['q']={7,2}; M['r']={7,3}; M['s']={7,4}; M['t']={8,1}; M['u']={8,2}; M['v']={8,3}; M['w']={9,1}; M['x']={9,2}; M['y']={9,3}; M['z']={9,4}; //pound functionality now char last = 'X'; for(auto u:s){ if(M[u].first==M[last].first) cout << "#"; last=u; for(int i = 0; i<M[u].second; i++){ cout << m[M[u].first]; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...