DMOPC '17 Contest 5 P1 - IOI 101

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

The number 1 looks quite similar to the letter l and the letter I. Similarly, the number 0 looks quite similar to the letter o. Sometimes, these simple replacements are used in passwords.

Roger is reviewing his passwords one day, and realizes that he no longer remembers what letters he replaced with numbers! Alarmed, he pulls up the following table:

Number Letter
0 O
1 l
3 E
4 A
5 S
6 G
8 B
9 g

Given a string of alphanumeric characters, can you write a program to perform these replacements?

Constraints

The given string will contain no more than 1\,000 characters.

Input Specification

The first and only line of input will contain a single string of alphanumeric characters.

Output Specification

The output should have a single string: the result of performing all the replacements on the string given in the input.

Sample Input

y0105w49

Sample Output

yOlOSwAg

Comments


  • 0
    sre0x2a  commented on May 18, 2025, 12:31 p.m.

    How exactly is a lookup table slower than branch statements with their potential branch predication misses in their fetch pipeline? I kind of question the legitimacy of the grader because of that. If you also notice there is a big difference in memory usage from pre 2022 submissions and post for similar algorithms implemented using the same compiler/interpreter/toolchain on almost any problem on the website. Maybe that is expected but that seems a bit off to me.


    • 1
      d  commented on May 19, 2025, 12:11 a.m. edited

      How exactly is a lookup table slower than branch statements with their potential branch predication misses in their fetch pipeline?

      Random server luck. If you're trying to go for the fastest solution, your sub will be affected by random background processes that can delay your sub by 1-2 ms. Try resubmitting a few times.

      there is a big difference in memory usage from pre 2022 submissions and post

      The runtimes are upgraded often. Newer compilers tend to use more memory. Probably caused by https://en.wikipedia.org/wiki/Software_bloat

      The admins can rejudge subs, but rejudging on every compiler upgrade is a bad use of resources.