#include<bits/stdc++.h>
using namespace std;
#define int64_t long long
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
int N, M;
void Solve(void) {
vector<int> lab(12);
for (int i = 1; i <= 9; i ++) {
int x; cin >> x;
lab[x] = i;
}
string letter; cin >> letter;
string text = "";
int number = 2;
vector<string> to(30);
for (int a = 0; a < 15; a ++) {
text = text + char(number + '0');
to[a] = text;
if ((int)text.size() == 3) {
text = "";
number ++;
}
}
to[15] = "7", to[16] = "77", to[17] = "777", to[18] = "7777";
to[19] = "8", to[20] = "88", to[21] = "888";
to[22] = "9", to[23] = "99", to[24] = "999", to[25] = "9999";
for (int i = 0; i < (int)letter.size(); i ++) {
int c = letter[i] - 'a';
if (i) {
int d = letter[i - 1] - 'a';
if (d/3 == c/3) cout << "#";
}
for (auto x : to[c]) {
cout << lab[x - '0'];
// cout << x;
}
}
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int Tests = 1; // cin >> Tests;
while (Tests --) {
Solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |