# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51549 | tranxuanbach | Mobitel (COCI14_mobitel) | C++17 | 3 ms | 760 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>
#define int long long
using namespace std;
const int N = 10;
int key[10];
int let[26] = {2, 2, 2,
3, 3, 3,
4, 4, 4,
5, 5, 5,
6, 6, 6,
7, 7, 7, 7,
8, 8, 8,
9, 9, 9, 9};
signed main(){
for (int i = 1; i <= 9; i++){
int x;
cin >> x;
key[x] = i;
}
string word, ans = "";
cin >> word;
int val, valkey, valkeyp = 0;
for (int i = 0; i < word.length(); i++){
val = word[i] - 'a';
valkey = let[val];
if (valkey == valkeyp){
ans += "#";
}
//cout << val << " " << valkey << " " << key[valkey] << endl;
valkeyp = valkey;
while (let[val] == valkey){
ans += (char)(key[valkey] + '0');
val--;
}
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |