#include <bits/stdc++.h>
#define N 1000005
#define ll long long int
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("kmp.in","r",stdin);freopen ("kmp.out","w",stdout);
#define mod 1000000009
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
#define INF 1000000000005
using namespace std;
ll n,m,ar[N],sum,tut[N],last;
string s;
void f1(char a)
{
ll x=a-'a';
ll y=x/3+2;
ll z=x%3;
if(last==tut[y])
cout<<"#";
fo(i,1,z+1)
cout<<tut[y];
last=tut[y];
}
void f2(char a)
{
ll x=a-'a';
ll y=0;
ll z=0;
if(x<=18)
y=7,z=x-15;
if(!y && x<=21)
y=8,z=x-19;
if(!y && x<=25)
y=9,z=x-22;
// if(a=='v')
// {
// cout<<endl;
// cout<<x<<sp<<y<<sp<<z<<endl;
// cout<<endl;
// }
if(last==tut[y])
cout<<"#";
fo(i,1,z+1)
cout<<tut[y];
last=tut[y];
}
int main()
{
fast;
fo(i,1,9)
{
int tmp;
cin>>tmp;
tut[tmp]=i;
}
cin>>s;
n=s.size();
for(int i=0;i<n;i++)
{
if(s[i]-'a'+1<=18)
f1(s[i]);
else
f2(s[i]);
}
}
/* cd onedrive\desktop\kod
cls
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
380 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
380 KB |
Output is correct |