# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165924 | itiam | Mobitel (COCI14_mobitel) | C++11 | 3 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <sstream>
using namespace std;
char La[26]={'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','7','8','8','8','9','9','9','9'};
int La2[26]={1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4};
int L[13];
int L3[1004];
int main(){
int y,brp;
for (int i=1;i<10;i++){
cin >> y;
L[i]=y;
}
string S,z;
char prbr='*',a;
cin >> S;
int x=S.length();
for (int i=0;i<x;i++){
a=S[i];
brp=La2[(int)a-97];
if (prbr==La[(int)a-97]){
z+='#';
}
else prbr=La[(int)a-97];
for (int j=0;j<brp;j++){
z+=La[(int)a-97];
}
}
char d;
string L2[1004];
int e=z.length();
for (int i=1;i<=9;i++){
for (int j=0;j<e;j++){
string str= to_string(L[i]);
string stri= to_string(i);
if (z[j]==str[0] && L3[j]!=1){
L2[j]=stri;
L3[j]=1;
}
else if (z[j]!=str[0] && L3[j]!=1){
L2[j]=z[j];
}
}
}
for (int i=0;i<e;i++){
cout << L2[i];
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |