# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
201449 | EmmanuelAC | Mobitel (COCI14_mobitel) | C++14 | 5 ms | 376 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;
char v[9];
char last, curr;
int key(char c){
if(c >= 'a' && c <= 'c'){
curr = v[1];
return 1 + (int)(c - 'a');
}
if(c >= 'd' && c <= 'f'){
curr = v[2];
return 1 + (int)(c - 'd');
}
if(c >= 'g' && c <= 'i'){
curr = v[3];
return 1 + (int)(c - 'g');
}
if(c >= 'j' && c <= 'l'){
curr = v[4];
return 1 + (int)(c - 'j');
}
if(c >= 'm' && c <= 'o'){
curr = v[5];
return 1 + (int)(c - 'm');
}
if(c >= 'p' && c <= 's'){
curr = v[6];
return 1 + (int)(c - 'p');
}
if(c >= 't' && c <= 'v'){
curr = v[7];
return 1 + (int)(c - 't');
}
if(c >= 'w' && c <= 'z'){
curr = v[8];
return 1 + (int)(c - 'w');
}
}
int main(){
for(int i=0; i<9; i++){
int aux; cin >> aux;
v[aux -1] = (char)('1' +i);
}
string s; cin >> s;
last = '*';
for(auto c : s){
int k = key(c);
if(curr == last)
cout << "#";
for(int i=0; i<k; i++) cout << curr;
last = curr;
}
cout << "\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |