# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
999561 | May27_th | Mobitel (COCI14_mobitel) | C++17 | 0 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |