CF1201A.Important Exam

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A class of students wrote a multiple-choice test.

There are nn students in the class. The test had mm questions, each of them had 55 possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question ii worth aia_i points. Incorrect answers are graded with zero points.

The students remember what answers they gave on the exam, but they don't know what are the correct answers. They are very optimistic, so they want to know what is the maximum possible total score of all students in the class.

一个班级的学生参加了一次多项选择题测试。

班级中共有 nn 名学生。测试共有 mm 道题目,每道题均有 55 个可能的答案(A、B、C、D 或 E)。每道题有且仅有一个正确答案。第 ii 题的正确答案值 aia_i 分。答错不得分。

学生们记得自己在考试中给出的答案,但不知道各题的正确答案。他们非常乐观,因此希望知道全班学生可能获得的最高总分。

输入格式

The first line contains integers nn and mm (1≤n,m≤10001 \le n, m \le 1000) — the number of students in the class and the number of questions in the test.

Each of the next nn lines contains string sis_i (∣si∣=m|s_i| = m), describing an answer of the ii-th student. The jj-th character represents the student answer (A, B, C, D or E) on the jj-th question.

The last line contains mm integers a1,a2,…,ama_1, a_2, \ldots, a_m (1≤ai≤10001 \le a_i \le 1000) — the number of points for the correct answer for every question.

第一行包含两个整数 nn 和 mm(1≤n,m≤10001 \le n, m \le 1000)—— 分别表示班级中的学生人数和测试中的题目数量。

接下来的 nn 行中,每行包含一个字符串 sis_i(∣si∣=m|s_i| = m),表示第 ii 个学生的作答情况。其中第 jj 个字符表示该学生对第 jj 道题的回答(A、B、C、D 或 E)。

最后一行包含 mm 个整数 a1,a2,…,ama_1, a_2, \ldots, a_m(1≤ai≤10001 \le a_i \le 1000)—— 表示每道题答对时所获得的分数。

输出格式

Print a single integer — the maximum possible total score of the class.

输出一个整数——班级可能获得的最高总分。

输入输出样例

  • 输入#1

    2 4
    ABCD
    ABCE
    1 2 3 4

    输出#1

    16
  • 输入#2

    3 3
    ABC
    BCD
    CDE
    5 4 12

    输出#2

    21

说明/提示

In the first example, one of the most optimal test answers is "ABCD", this way the total number of points will be 1616.

In the second example, one of the most optimal test answers is "CCC", this way each question will be answered by exactly one student and the total number of points is 5+4+12=215 + 4 + 12 = 21.

在第一个例子中,一种最优的测试答案是“ABCD”,此时总得分为 1616。

在第二个例子中,一种最优的测试答案是“CCC”,此时每个问题恰好被一名学生答对,总得分为 5+4+12=215 + 4 + 12 = 21。

输入解题思路,AI测评打分。不知道怎么写?

首页