#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];
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
316 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
324 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
320 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |