제출 #1215718

#제출 시각아이디문제언어결과실행 시간메모리
1215718Robert_junior고장난 휴대전화기 (COCI14_mobitel)C++20
0 / 50
1 ms328 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(), x.end()
#define ins insert
#define pb push_back
#define F first
#define S second
const int N = 1e6 + 7, M = 5e5 + 7;
const int mod = 1e9 + 7;
void solve(){
    int a[10], b[27], c[27];
    for(int i = 1; i <= 9; i++){
        int x;
        cin>>x;
        a[x] = i;
    }
    for(int i = 0; i < 26; i++){
        b[i] = min(9ll, (i / 3) + 2);
        //cout<<b[i]<<' '<<(char)('a' + i)<<'\n';
        c[i] = i % 3 + 1;
    }
    c[21] = 3;
    c[18] = 4; 
    b[18] = 7;
    b[21] = 8;
    c[22] = 1;
    c[23] = 2;
    c[24] = 3;
    c[25] = 4;
    string s;
    cin>>s;
    int lst = -1;
    for(int i = 0; i < s.size(); i++){
        int x = s[i] - 'a';
        if(lst == b[x]) cout<<'#';
        //cout<<x<<' '<<b[x]<<'\n';
        int cur = x % 3 + 1;
        for(int j = 0; j < c[x]; j++){
            cout<<a[b[x]];
        }
        lst = b[x];
    }
}
signed main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t; 
    for(int i = 1; i <= t; i++){
        //cout<<"Case "<<i<<": ";
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...