# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
686659 |
2023-01-25T17:26:22 Z |
mdub |
Mobitel (COCI14_mobitel) |
C++14 |
|
1 ms |
340 KB |
#include <bits/stdc++.h>
using namespace std;
int main () {
vector<string> touches = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
map<char, string> letters;
for (int k = 1; k <= 9; k++) {
int num; cin >> num;
for (int i = 1; i <= touches[num].size(); i++) {
letters[touches[num][i-1]] = "";
for (int j = 0; j < i; j++) letters[touches[num][i-1]] += char(int('0') + k);
}
}
int last = '0';
string message; cin >> message;
for (auto c: message) {
if (letters[c][0] == last) cout << "#";
cout << letters[c];
last = letters[c][0];
}
cout << '\n';
}
Compilation message
mobitel.cpp: In function 'int main()':
mobitel.cpp:10:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
10 | for (int i = 1; i <= touches[num].size(); i++) {
| ~~^~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
304 KB |
Output is correct |
7 |
Correct |
1 ms |
304 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
300 KB |
Output is correct |