# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
960253 | khangrl | Mobitel (COCI14_mobitel) | C++14 | 1058 ms | 32516 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 ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
int main(){
int arr[10];
for(int i=1; i<=9; i++){
int a;
cin>>a;
arr[a]=i;
}
string s;
cin>>s;
int last=0;
for(int i=0; i<s.size(); i++){
int n, k=s[i];
if(s[i]=='a' or s[i]=='b' or s[i]=='c'){
if(arr[2]==last){
cout<<'#';
}
last=arr[2];
n='a';
n--;
}
else if(s[i]=='d' or s[i]=='e' or s[i]=='f'){
if(arr[3]==last){
cout<<'#';
}
last=arr[3];
n='d';
n--;
}
else if(s[i]=='g' or s[i]=='h' or s[i]=='i'){
if(arr[4]==last){
cout<<'#';
}
last=arr[4];
int n='g';
n--;
}
else if(s[i]=='j' or s[i]=='k' or s[i]=='l'){
if(arr[5]==last){
cout<<'#';
}
last=arr[5];
n='j';
n--;
}
else if(s[i]=='m' or s[i]=='n' or s[i]=='o'){
if(arr[6]==last){
cout<<'#';
}
last=arr[6];
n='m';
n--;
}
else if(s[i]=='p' or s[i]=='q' or s[i]=='r' or s[i]=='s'){
if(arr[7]==last){
cout<<'#';
}
last=arr[7];
n='p';
n--;
}
else if(s[i]=='t' or s[i]=='u' or s[i]=='v'){
if(arr[8]==last){
cout<<'#';
}
last=arr[8];
n='t';
n--;
}
else if(s[i]=='w' or s[i]=='x' or s[i]=='y' or s[i]=='z'){
if(arr[9]==last){
cout<<'w';
}
last=arr[9];
n='w';
n--;
}
k-=n;
while(k--){
cout<<last;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |