Submission #882813

# Submission time Handle Problem Language Result Execution time Memory
882813 2023-12-03T18:26:36 Z unexpectedbro Mobitel (COCI14_mobitel) C++14
0 / 50
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
int main() {
	map<int, string>q;
	map<char, string>a;
	q[1] = " ";
	q[2] = "abc";
	a[3] = "def";
	q[4] = "ghi";
	q[5] = "jkl";
	q[6] = "mno";
	q[7] = "pqrs";
	q[8] = "tuv";
	q[9] = "wxyz";
	for (int i = 1; i <= 9; i++) {
		int x; cin >> x;
		string val = to_string(i);
		for (auto c : q[x]) {
			a[c] = val;
			val += to_string(i);
		}
	}
	string quest;
	cin >> quest;
	string res = "";
	for (int i = 0; i < quest.size(); i++) {
		string ans = a[quest[i]];
		if (i) {
			if (ans[0] == res.back()) {
				res += "#";
			}
		}
		res += ans;
	}
	cout << res << endl;

}

Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for (int i = 0; i < quest.size(); i++) {
      |                  ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -