# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
397599 | victoriad | Mobitel (COCI14_mobitel) | C++14 | 1 ms | 224 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 <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
vector<int>g(9);
int a;
for(int i=0;i<9;i++){
cin>>a;
g[a-1]=i+1;
}
int ant=-1;
string s;
cin>>s;
for(int i=0;i<s.length();i++){
if(s[i]=='a'){
if(ant==g[1]){
cout<<'#'<<g[1];
}
else{
cout<<g[1];
}
ant=g[1];
}
else if(s[i]=='b'){
if(ant==g[1]){
cout<<'#'<<g[1]<<g[1];
}
else{
cout<<g[1]<<g[1];
}
ant=g[1];
}
else if(s[i]=='c'){
if(ant==g[1]){
cout<<'#'<<g[1]<<g[1]<<g[1];
}
else{
cout<<g[1]<<g[1]<<g[1];
}
ant=g[1];
}
else if(s[i]=='d'){
if(ant==g[2]){
cout<<'#'<<g[2];
}
else{
cout<<g[2];
}
ant=g[2];
}
else if(s[i]=='e'){
if(ant==g[2]){
cout<<'#'<<g[2]<<g[2];
}
else{
cout<<g[2]<<g[2];
}
ant=g[2];
}
else if(s[i]=='f'){
if(ant==g[2]){
cout<<'#'<<g[2]<<g[2]<<g[2];
}
else{
cout<<g[2]<<g[2]<<g[2];
}
ant=g[2];
}
else if(s[i]=='g'){
if(ant==g[3]){
cout<<'#'<<g[3];
}
else{
cout<<g[3];
}
ant=g[3];
}
else if(s[i]=='h'){
if(ant==g[3]){
cout<<'#'<<g[3]<<g[3];
}
else{
cout<<g[3]<<g[3];
}
ant=g[3];
}
else if(s[i]=='i'){
if(ant==g[3]){
cout<<'#'<<g[3]<<g[3]<<g[3];
}
else{
cout<<g[3]<<g[3]<<g[3];
}
ant=g[3];
}
else if(s[i]=='j'){
if(ant==g[4]){
cout<<'#'<<g[4];
}
else{
cout<<g[4];
}
ant=g[4];
}
else if(s[i]=='k'){
if(ant==g[4]){
cout<<'#'<<g[4]<<g[4];
}
else{
cout<<g[4]<<g[4];
}
ant=g[4];
}
else if(s[i]=='l'){
if(ant==g[4]){
cout<<'#'<<g[4]<<g[4]<<g[4];
}
else{
cout<<g[4]<<g[4]<<g[4];
}
ant=g[4];
}
else if(s[i]=='m'){
if(ant==g[5]){
cout<<'#'<<g[5];
}
else{
cout<<g[5];
}
ant=g[5];
}
else if(s[i]=='n'){
if(ant==g[5]){
cout<<'#'<<g[5]<<g[5];
}
else{
cout<<g[5]<<g[5];
}
ant=g[5];
}
else if(s[i]=='o'){
if(ant==g[5]){
cout<<'#'<<g[5]<<g[5]<<g[5];
}
else{
cout<<g[5]<<g[5]<<g[5];
}
ant=g[5];
}
else if(s[i]=='p'){
if(ant==g[6]){
cout<<'#'<<g[6];
}
else{
cout<<g[6];
}
ant=g[6];
}
else if(s[i]=='q'){
if(ant==g[6]){
cout<<'#'<<g[6]<<g[6];
}
else{
cout<<g[6]<<g[6];
}
ant=g[6];
}
else if(s[i]=='r'){
if(ant==g[6]){
cout<<'#'<<g[6]<<g[6]<<g[6];
}
else{
cout<<g[6]<<g[6]<<g[6];
}
ant=g[6];
}
else if(s[i]=='s'){
if(ant==g[6]){
cout<<'#'<<g[6]<<g[6]<<g[6]<<g[6];
}
else{
cout<<g[6]<<g[6]<<g[6]<<g[6];
}
ant=g[6];
}
else if(s[i]=='t'){
if(ant==g[7]){
cout<<'#'<<g[7];
}
else{
cout<<g[7];
}
ant=g[7];
}
else if(s[i]=='u'){
if(ant==g[7]){
cout<<'#'<<g[7]<<g[7];
}
else{
cout<<g[7]<<g[7];
}
ant=g[7];
}
else if(s[i]=='v'){
if(ant==g[7]){
cout<<'#'<<g[7]<<g[7]<<g[7];
}
else{
cout<<g[7]<<g[7]<<g[7];
}
ant=g[7];
}
else if(s[i]=='w'){
if(ant==g[8]){
cout<<'#'<<g[8];
}
else{
cout<<g[8];
}
ant=g[8];
}
else if(s[i]=='x'){
if(ant==g[8]){
cout<<'#'<<g[8]<<g[8];
}
else{
cout<<g[8]<<g[8];
}
ant=g[8];
}
else if(s[i]=='y'){
if(ant==g[8]){
cout<<'#'<<g[8]<<g[8]<<g[8];
}
else{
cout<<g[8]<<g[8]<<g[8];
}
ant=g[8];
}
else if(s[i]=='z'){
if(ant==g[8]){
cout<<'#'<<g[8]<<g[8]<<g[8]<<g[8];
}
else{
cout<<g[8]<<g[8]<<g[8]<<g[8];
}
ant=g[8];
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |