# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
163213 | beso123 | Mobitel (COCI14_mobitel) | C++14 | 2 ms | 376 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>
#define int long long
using namespace std;
string s;
int a[10];
map <int,string> mp;
main(){
mp[2]="abc";
mp[3]="def";
mp[4]="ghi";
mp[5]="jkl";
mp[6]="mno";
mp[7]="pqrs";
mp[8]="tuv";
mp[9]="wxyz";
for(int k=1;k<=9;k++){
int h;
cin>>h;
a[h]=k;
}
cin>>s;
string ans="";
char l='&';
for(int k=0;k<s.size();k++){
string pas="";
for(int i=2;i<=9;i++){
for(int j=0;j<mp[i].size();j++){
if(s[k]==mp[i][j]){
int u=a[i];
if(j>=0)
pas+=(u+'0');
if(j>=1)
pas+=(u+'0');
if(j>=2)
pas+=(u+'0');
if(j>=3)
pas+=(u+'0');
break;
}
}
}
if(l==pas[0])
ans=ans+'#'+pas;
else ans=ans+pas;
l=pas[0];
}
cout<<ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |