hkshakib

Untitled

Feb 11th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main()
  5. {
  6. int t;
  7. ll ans=0;
  8. cin>>t;
  9. while(t--)
  10. {
  11. ll n;
  12. cin>>n;
  13. cin.ignore();
  14. char s;
  15. ll x;
  16. ll arr[6][6]= {0};
  17. for(int i=0; i<n; i++)
  18. {
  19. cin>>s>>x;
  20. arr[ s-'A'][ (x/3)-1]+=1;
  21. }
  22. ll sum=-1e9-1;
  23. for(int i=0; i<4; i++)
  24. {
  25. vector <ll> v1;
  26. v1.push_back(arr[0][i]);
  27. for(int j=0; j<4; j++)
  28. {
  29. if(i==j)
  30. continue;
  31. vector<ll> v2(v1);
  32. v2.push_back(arr[1][j]);
  33. for(int k=0; k<4; k++)
  34. {
  35. if(k==i || k==j)
  36. continue;
  37. vector<ll> v3(v2);
  38. v3.push_back(arr[2][k]);
  39. for(int l=0; l<4; l++)
  40. {
  41. if(l==i || l==j || l==k)
  42. continue;
  43. vector <ll> v4(v3);
  44. v4.push_back(arr[3][l]);
  45. sort(v4.rbegin(),v4.rend());
  46. ll cnt=0;
  47. ll lose=0;
  48. cnt+=(v4[0]*100);
  49. cnt+=(v4[1]*75);
  50. cnt+=(v4[2]*50);
  51. cnt+=(v4[3]*25);
  52. for(int m=0; m<4; m++)
  53. {
  54. if(v4[m]==0)
  55. lose++;
  56. }
  57. lose*=100;
  58. cnt-=lose;
  59. sum=max(sum,cnt);
  60. }
  61. }
  62. }
  63. }
  64. cout<<sum<<endl;
  65. ans+=sum;
  66. }
  67. cout<<ans<<endl;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment