Saleh127

CF 1201A.cpp

Jul 5th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. ll c[2000][200]={0},d,e,f,i,j,k,l=0;
  7. int main()
  8. {
  9. fellow_junior
  10. string a;
  11. cin>>d>>e;
  12. for(i=0;i<d;i++)
  13. {
  14. cin>>a;
  15. for(j=0;j<e;j++)
  16. {
  17. c[j][a[j]]++;
  18. }
  19. }
  20. for(i=0;i<e;i++)
  21. {
  22. cin>>f;
  23. k=0;
  24. for(j='A';j<='E';j++)
  25. {
  26. k=max(k,c[i][j]);
  27. }
  28. l+=k*f;
  29. }
  30. cout<<l<<endl;
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment