-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy patha.cc
More file actions
30 lines (28 loc) · 610 Bytes
/
Copy patha.cc
File metadata and controls
30 lines (28 loc) · 610 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// https://codeforces.com/contest/1201/problem/A
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi=vector<vi>;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vvi a(m, vi(5));
for (int i = 0; i < n; i++) {
string s;
cin >> s;
for (int j = 0; j < m; j++)
a[j][s[j] - 'A'] ++;
}
vi b(m);
for (int i = 0; i < m; i++) cin >> b[i];
ll s = 0;
for (int i = 0; i < m; i++) {
int M = a[i][0];
for (int j = 1; j < 5; j++) M = max(M, a[i][j]);
s += (M * b[i]);
}
cout << s << "\n";
}