#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e9;
const int maxn=100;
const ll mod=1e9+7;
vector <pair<int,int>> color(500,{0,0});
vector <int> used(20);
void solve(){
vector <int> b(10);
char k='a';
int cnt=2;
for(int i=1;i<=15;i++){
color[k]={cnt,i%3==0?3:i%3};
if(i%3==0){
cnt++;
}
k++;
}
//pqrs
color['p']={cnt,1};
color['q']={cnt,2};
color['r']={cnt,3};
color['s']={cnt,4};
cnt++;
color['t']={cnt,1};
color['u']={cnt,2};
color['v']={cnt,3};
cnt++;
color['w']={cnt,1};
color['x']={cnt,2};
color['y']={cnt,3};
color['z']={cnt,4};
for(int i=1;i<=9;i++){
cin>>b[i];
used[b[i]]=i;
}
string s;
cin>>s;
char last='#';
for(int i=0;i<s.size();i++){
//cout<<color[s[i]].first<<" "<<color[s[i]].second<<endl;
if(color[last].first==color[s[i]].first)cout<<"#";
int component=color[s[i]].first;
int index=used[component];
for(int t=0;t<color[s[i]].second;t++)cout<<index;
last=s[i];
}
}
int main(){
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
int t=1;
//cin>>t;
while(t--){
solve();
cout<<'\n';
}
}
Compilation message
mobitel.cpp: In function 'void solve()':
mobitel.cpp:43:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(int i=0;i<s.size();i++){
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
296 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |