# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
201449 | 2020-02-10T15:23:49 Z | EmmanuelAC | Mobitel (COCI14_mobitel) | C++14 | 5 ms | 376 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |