제출 #1226368

#제출 시각아이디문제언어결과실행 시간메모리
1226368dibamboo23고장난 휴대전화기 (COCI14_mobitel)C++20
0 / 50
0 ms320 KiB
#include <bits/stdc++.h>

#define ll long long
#define F first
#define S second
#define sz size()

using namespace std;

[[maybe_unused]]const int e6=1e6;
[[maybe_unused]]const int e7=1e7;
[[maybe_unused]]const int e8=1e8;
[[maybe_unused]]const int e9=1e9;

inline int rd(){
	int num;cin>>num;
	return num;
}

inline ll rdll(){
	ll num;cin>>num;
	return num;
}

[[maybe_unused]]const ll inf=1e18+7;
[[maybe_unused]]const ll MOD=1e9+7;
[[maybe_unused]]const int N=1e6+3;

int m[N];

vector<string>a={"a b c" ,"d e f", "g h i","j k l"," m n o"," p q r s"," t u v","w x y z"};

void code(){
	for(auto &to:a){
		string s="";
		for(int i=0;i<(int)to.sz;i++){
			if(to[i]==' ')continue;
			s+=to[i];
		}
		to=s;
	}
	for(int i=1;i<=9;i++)cin>>m[i];
	string s;cin>>s;
	string res="";
	for(int i=0;i<(int)s.sz;i++){
		for(int j=0;j<9;j++){
			int pos=a[j].find(s[i]);
			if(pos!=-1){
				if(res.back()==char(m[j]+'0'))res+='#';
				res+=char(m[j]+'0');
				while(pos--)res+=char(m[j]+'0');
			}
		}
	}
	cout<<res;
}




signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int tt=1;
	// cin>>tt;
	while(tt--)code(),cout<<"\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...