제출 #484571

#제출 시각아이디문제언어결과실행 시간메모리
484571asandikciMobitel (COCI14_mobitel)C++17
50 / 50
1 ms204 KiB
//Copyright © 2021 Aliberk Sandıkçı. All rights reserved.

#include "bits/stdc++.h"
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define fori(a,b) for(int i=a;i<=b;i++)
#define forj(a,b) for(int j=a;j<=b;j++)
#define fi first
#define se second
#define debu cout << "*debug*\n"
#define debug(x) cout << "debug " << x <<"\n"
#define int long long
constexpr int modn = 1e9+7;		// 998244353
constexpr int maxn = 1e6+5;	
constexpr int INF = 1e9+5;	
using namespace std;

string keyb[] = {"!!!!","----","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};


void solve(){
   string broken[15];
   int tmp;
   fori(1,9){
      cin >> tmp;
      broken[i]=keyb[tmp];
   }
   string str;
   cin >> str;
   int pre=-1;
   for(auto let : str){
      fori(1,9){
         int num=0;
         for(auto it : broken[i]){
            num++;
            if(it==let){
               if(pre==i){
                  cout << "#";
               }
               forj(1,num){
                  cout << i << "";
               }
               pre=i;
            }
         }
      }
   }


}

signed main(){
	ios::sync_with_stdio(0);cin.tie(0);	
	//freopen("","r",stdin);
	//freopen("","w",stdout);	

	int T=1;
	//cin >> T;	
	while(T--){
		solve();	
	}	
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...