50024. Grade

I'm a slow walker, but I never walk backwards.

Problem Description

Read problems statements in Mandarin ChineseMorris AI 翻譯:
實作一個計分程式,每一題為多選題,且最多 ABCDE 五個選項,若學生不慎少或者是多一個選項都算錯,答對得 $r$ 分,答錯倒扣 $w$ 分。特別注意:書寫答案可以不按照順序、大小寫字母,若學生分數低於零分,以零分計算。

Write a program to grade a test of multiple choice questions. The test has $n$ questions. Each question has a correct answer consisting of up to five uppercase letters from A, B, C, D, and E. If a student answers it correctly then he/she receives $r$ points. If a student answers it incorrectly then he/she receives $-w$ points. If a student does not answers it then he/she receives zero points. Now given $n, \; r, \; w$, the correct answers and the student's answer, please calculate the number of points the student receives. Note that if the student has negative number of points because of the wrong answers, your program should report 0.

Technical Specification and constraints

  • $n \le 50$
  • $1 \le r \le 50, \; 0 \le w \le r$

Subtasks

  • 25pt. The student answers all question and the answers are always in a proper form. That is, They are all in upper cases and sorted, e.g. "ABD", "CD", and "AE".
  • 25pt. The student answers all questions but the answer may not be in a proper form. That is, they could have lower case letters but it is always sorted, e.g. "Abd", "cD", and "aE".
  • 25pt. The student answers all questions but the answers may not be in a proper form. That is, they could have lower case letters and it is not always sorted, e.g. "bAd", "Dc", and "Ea".
  • 25pt. The student may not answer all questions and the answers may not be in a proper form. If the student does not answer a question, he/she will enter "N/A".

Sample Input

5 20 4
A B A B C
3
A B N/A B C
A B C B C
N/A N/A N/A A B
 
5 20 4
AB ABC BC CD D
3
AB ABC N/A C C
Ab abc bc cd D
bA bac bc cd c

Sample Output

80
76
0
32
100
76

Discussion