Submission #904303

# Submission time Handle Problem Language Result Execution time Memory
904303 2024-01-12T02:52:42 Z Jawad_Akbar_JJ Mobitel (COCI14_mobitel) C++17
0 / 50
0 ms 348 KB
#include <iostream>
#include <map>

using namespace std;

map<char,int> mp;
map<pair<char,char>,bool> same;
map<char,char> mp2;
void set(string s,int a){
	int b = a;
	for (char i : s)
		mp[i] = b,b = b * 10 + a;

	for (int i : s)
		for (int j : s)
			same[{i,j}] = true;
}

int main() {
	set("abc",2);
	set("def",3);
	set("ghi",4);
	set("jkl",5);
	set("mno",6);
	set("pqrs",7);
	set("tuv",8);
	set("wxyz",9);

	for (int i=1;i<=9;i++){
		int a;
		cin>>a;
		mp2[(char(i + 48))] = char(a + 48);
	}
	mp2['#'] = '#';

	string s,ss;
	cin>>s;
	int n = s.size();
	s = '0' + s;

	for (int i=1;i<=n;i++){
		if (same[{s[i-1],s[i]}])
			ss += '#';
		int a = mp[s[i]];
		for (char j : to_string(a))
			ss += j;
	}

	for (char j : ss)
		cout<<mp2[j];
	cout<<endl;

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -