# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
468562 | ala2 | Mobitel (COCI14_mobitel) | C++14 | 1 ms | 296 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;
int a[1000100];
map<char,int>m;
map<int,string>m2;
int main()
{
for(int i=1;i<=9;i++)
{
int x;
cin>>x;
a[x]=i;
}
m['a']=m['b']=m['c']=2;
m['d']=m['e']=m['f']=3;
m['g']=m['h']=m['i']=4;
m['j']=m['k']=m['l']=5;
m['m']=m['n']=m['o']=6;
m['p']=m['q']=m['r']=m['s']=7;
m['t']=m['u']=m['v']=8;
m['w']=m['x']=m['y']=m['z']=9;
m2[2]="abc";
m2[3]="def";
m2[4]="ghi";
m2[5]="jkl";
m2[6]="mno";
m2[7]="pqrs";
m2[8]="tuv";
m2[9]="wxyz";
string s;
cin>>s;
for(int i=0;i<s.size();i++)
{
if(i>0&&m[s[i]]==m[s[i-1]])
cout<<'#';
int x=m[s[i]];
string c=m2[x];
for(int j=0 ; ;j++ )
{
cout<<a[x];
if(c[j]==s[i])
break;
}
}
cout<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |