Submission #484571

# Submission time Handle Problem Language Result Execution time Memory
484571 2021-11-04T12:38:49 Z asandikci Mobitel (COCI14_mobitel) C++17
50 / 50
1 ms 204 KB
//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 time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct