# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
201303 | ArKCa | Mobitel (COCI14_mobitel) | C++17 | 6 ms | 504 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<bits/stdc++.h>
#define f1 first
#define s2 second
#define pb push_back
#define pob pop_back
#define int ll
#define ll long long
#define PII pair<int,int>
#define N 11
using namespace std;
int n,a,last,b;
int dizi[N];
string s;
int calc(char c){
if( c=='a' || c=='b' || c=='c' )return 2;
if( c=='d' || c=='e' || c=='f' )return 3;
if( c=='g' || c=='h' || c=='i' )return 4;
if( c=='j' || c=='k' || c=='l' )return 5;
if( c=='m' || c=='n' || c=='o' )return 6;
if( c=='t' || c=='u' || c=='v' )return 8;
if( c=='p' || c=='q' || c=='r' || c=='s' )return 7;
if( c=='w' || c=='x' || c=='y' || c=='z' )return 9;
}
int calc1(char c){
if( c=='a' || c=='d' || c=='g' || c=='j' || c=='m' || c=='t' || c=='p' || c=='w' )return 1;
if( c=='b' || c=='e' || c=='h' || c=='k' || c=='n' || c=='u' || c=='q' || c=='x' )return 2;
if( c=='c' || c=='f' || c=='i' || c=='l' || c=='o' || c=='v' || c=='r' || c=='y' )return 3;
if( c=='s' || c=='z' )return 4;
}
int32_t main(){
// freopen("a.gir","r",stdin);
// freopen("a.cik","w",stdout);
for(int i=1;i<=9;i++){
scanf("%lld",&a);
dizi[a]=i;
}
cin>>s;
for(int i=0;i<s.size();i++){
a=calc(s[i]);
b=calc1(s[i]);
if(a==last)
printf("#");
while(b--)
printf("%lld",dizi[a] );
last=a;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |