VM7WC '16 #4 Gold - Restoring Reputation

View as PDF

Submit solution

Points: 10
Time limit: 0.6s
Memory limit: 64M

Authors:
Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Due to the (lack of) quality in the previous test cases that Jeffrey generated, his test cases are now frowned upon to use by the other problem setters. In an effort to restore his destroyed reputation in the Case Creation Community (CCC), Jeffrey is going through all of the input files he has, word by word, to improve the quality of his test data!

Jeffrey knows that if he doesn't have good quality test cases this week, he will forever be shamed in the CCC and could never make it to the prestigious Case Creation Organization (CCO). However, it is also a commonly known fact in the CCC that Jeffrey is a slow and lazy typer! For a given word in the input file, A, Jeffrey would like to transform it to a new word, B. In Jeffrey's world (filled with angry typing, mechanical keyboards, VIM and Linux), he has three different operations to transform the word.

Jeffrey can…

  • Delete a character from A using D seconds.
  • Insert a character into A using I seconds.
  • Replace a character in A with a new character using R seconds.

The difference in time for the different operations is obviously due to his loud mechanical keyboard.

Before Jeffrey starts going through all the words, he would like to know how long it will take for him to go through each word so he can find the total time to allocate out of his day. Of course, Jeffrey only wants to know the minimum amount of time he needs to fix each word, he needs all of the remaining time in his day to post dank memes online as a publicity stunt for maximum likes and comments. With this, he could gain enough popularity to be nominated to join the Case Creation Organization!

Input Specification

On the first line will be three space separated integers:

  • D (0 \leq D \leq 1\,000): The amount of time in seconds required to delete a character
  • I (0 \leq I \leq 1\,000): The amount of time in seconds required to insert a character
  • R (0 \leq R \leq 1\,000): The amount of time in seconds required to replace a character

The next line will contain two space separated strings, A and B. It is guaranteed that the length of A and B will be less than or equal to 1000.

Output Specification

Output the cheapest cost to transform word A to word B.

Sample Input

1 2 4
intention execution

Sample Output

12

Comments


  • -2
    mohituppal  commented on Jan. 29, 2016, 6:05 a.m.

    are the lengths of string A and B same ?


    • 1
      cheesecake  commented on Jan. 29, 2016, 11:31 a.m.

      Don't assume anything not explicitly stated in the problem.


  • 1
    cheesecake  commented on Jan. 28, 2016, 8:25 p.m.

    Submissions have been rejudged, sorry for the delay.


  • 3
    albertzhan  commented on Jan. 28, 2016, 5:19 p.m.

    The test cases can be string and nothing???


    • 1
      minecraftyugi  commented on Jan. 28, 2016, 5:21 p.m. edited

      Not sure what to do either.

      Edit: they're not actually separated by a space


      • 2
        JeffreyZ  commented on Jan. 28, 2016, 5:32 p.m.

        Hey, Diana is bad at making test cases. Some cases have the strings separated by spaces, other cases have them separated by newlines. I'm getting this fixed right now.


        • 2
          discoverMe  commented on Jan. 26, 2019, 2:43 p.m.

          how ironic


      • 2
        albertzhan  commented on Jan. 28, 2016, 5:32 p.m.

        the strings are on separate lines ...