#include <bits/stdc++.h>
#define ahmed_is_fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define ld long double
#define cc(n) cout << n << "\n"
#define ccc(n) cout << n << ' '
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mx(a, b) a = max(a, b)
#define mn(a, b) a = min(a, b)
#define mem(a, b) memset(a, b, sizeof(a))
#define f(a) a.first
#define s(a) a.second
#define lcm(a, b) (a * b) / __gcd(a, b)
#define sp(x) setprecision(x)
using namespace std;
ll freq[1000005]={0};
void ahmed()
{
ll n=9;
ll arr[n+9];
for(ll i=0; i<n; i++)
{
ll a;
cin>>a;
arr[a]=i+1;
}
string s="#",t;
cin>>t;
ll z=t.size();
ll j=1;
for(ll i=1; i<=z; i++)
{
ll a=t[i-1]-'a';
if(a==0)
{
if(s[j-1]=='2')
{
s+="#";
}
s+="2";
j++;
}
else if(a==1)
{
if(s[j-1]=='2')
{
s+="#";
}
s+="22";
j+=2;
}
else if(a==2)
{
if(s[j-1]=='2')
{
s+="#";
}
s+="222";
j+=3;
}
else if(a==3)
{
if(s[j-1]=='3')
{
s+="#";
}
s+="3";
j++;
}
else if(a==4)
{
if(s[j-1]=='3')
{
s+="#";
}
s+="33";
j+=2;
}
else if(a==5)
{
if(s[j-1]=='3')
{
s+="#";
}
s+="333";
j+=3;
}
else if(a==6)
{
if(s[j-1]=='4')
{
s+="#";
}
s+="4";
j++;
}
else if(a==7)
{
if(s[j-1]=='4')
{
s+="#";
}
s+="44";
j+=2;
}
else if(a==8)
{
if(s[j-1]=='4')
{
s+="#";
}
s+="444";
j+=3;
}
else if(a==9)
{
if(s[j-1]=='5')
{
s+="#";
}
s+="5";
j++;
}
else if(a==10)
{
if(s[j-1]=='5')
{
s+="#";
}
s+="55";
j+=2;
}
else if(a==11)
{
if(s[j-1]=='5')
{
s+="#";
}
s+="555";
j+=3;
}
else if(a==12)
{
if(s[j-1]=='6')
{
s+="#";
}
s+="6";
j++;
}
else if(a==13)
{
if(s[j-1]=='6')
{
s+="#";
}
s+="66";
j+=2;
}
else if(a==14)
{
if(s[j-1]=='6')
{
s+="#";
}
s+="666";
j+=3;
}
else if(a==15)
{
if(s[j-1]=='7')
{
s+="#";
}
s+="7";
j++;
}
else if(a==16)
{
if(s[j-1]=='7')
{
s+="#";
}
s+="77";
j+=2;
}
else if(a==17)
{
if(s[j-1]=='7')
{
s+="#";
}
s+="777";
j+=3;
}
else if(a==18)
{
if(s[j-1]=='7')
{
s+="#";
}
s+="7777";
j+=4;
}
else if(a==19)
{
if(s[j-1]=='8')
{
s+="#";
}
s+="8";
j++;
}
else if(a==20)
{
if(s[j-1]=='8')
{
s+="#";
}
s+="88";
j+=2;
}
else if(a==21)
{
if(s[j-1]=='8')
{
s+="#";
}
s+="888";
j+=3;
}
else if(a==22)
{
if(s[j-1]=='9')
{
s+="#";
}
s+="9";
j++;
}
else if(a==23)
{
if(s[j-1]=='9')
{
s+="#";
}
s+="99";
j+=2;
}
else if(a==24)
{
if(s[j-1]=='9')
{
s+="#";
}
s+="999";
j+=3;
}
else if(a==25)
{
if(s[j-1]=='9')
{
s+="#";
}
s+="9999";
j+=4;
}
// cout<<a<<endl;
}
for(ll i=1; i<s.size(); i++)
{
if(s[i]=='#')
{
cout<<"#";
}
else
{
ll a=s[i]-'0';
char c='0'+arr[a];
cout<<c;
}
}
}
bool AHMED = false;
int main()
{
ahmed_is_fast;
ll t = 1;
if (AHMED)
{
cin >> t;
}
while (t--)
{
ahmed();
}
return 0;
}
Compilation message
mobitel.cpp: In function 'void ahmed()':
mobitel.cpp:274:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
274 | for(ll i=1; i<s.size(); i++)
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |