hkshakib

Untitled

Feb 8th, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main()
  5. {
  6.  
  7. ll t, n, time, tot=0 ;
  8. char ch ;
  9. cin >> t ;
  10. while(t--)
  11. {
  12. cin >> n ;
  13. ll a[5]= {0},b[5]= {0},c[5]= {0},d[5]= {0};
  14. memset(a,0,sizeof a);
  15. memset(b,0,sizeof b);
  16. memset(b,0,sizeof b);
  17. memset(b,0,sizeof b);
  18. ll sum =0,mx = INT_MIN;
  19. for(int i=0 ; i<n ; i++)
  20. {
  21. cin >> ch >> time;
  22. if(time ==12)
  23. a[ch-'A']++;
  24. if(time ==3)
  25. b[ch-'A']++;
  26. if(time ==6)
  27. c[ch-'A']++;
  28. if(time ==9)
  29. d[ch-'A']++;
  30. }
  31. // for(int i=0 ; i<4 ; i++)cout << a[i]<<" "<<b[i]<<" "<<c[i]<<" "<<d[i]<<endl;
  32. for(int i=0 ; i<4 ; i++)
  33. {
  34.  
  35. for(int j=0 ; j<4 ; j++)
  36. {
  37.  
  38. for(int k=0 ; k<4 ; k++)
  39. {
  40.  
  41. for(int l=0 ; l<4 ; l++)
  42. {
  43.  
  44. ll mx1=0,mx2=0,mx3=0,mx4=0;
  45.  
  46. if(a[i])
  47. {
  48. mx1+=(a[i]*100);
  49. mx2+=(a[i]*75);
  50. mx3+=(a[i]*50);
  51. mx4+=(a[i]*25);
  52. }
  53. else
  54. {
  55. mx1-=100;
  56. mx2-=100;
  57. mx3-=100;
  58. mx4-=100;
  59. }
  60. if(b[j])
  61. {
  62. mx1+=(b[j]*75);
  63. mx2+=(b[j]*50);
  64. mx3+=(b[j]*25);
  65. mx4+=(b[j]*100);
  66. }
  67. else
  68. {
  69. mx1-=100;
  70. mx2-=100;
  71. mx3-=100;
  72. mx4-=100;
  73. }
  74. if(c[k])
  75. {
  76. mx1+=(c[k]*50);
  77. mx2+=(c[k]*25);
  78. mx3+=(c[k]*100);
  79. mx4+=(c[k]*75);
  80. }
  81. else
  82. {
  83. mx1-=100;
  84. mx2-=100;
  85. mx3-=100;
  86. mx4-=100;
  87. }
  88.  
  89. if(d[l])
  90. {
  91. mx1+=(d[l]*25);
  92. mx2+=(d[l]*100);
  93. mx3+=(d[l]*75);
  94. mx4+=(d[l]*50);
  95. }
  96. else
  97. {
  98. mx1-=100;
  99. mx2-=100;
  100. mx3-=100;
  101. mx4-=100;
  102. }
  103. //cout <<mx1<<" "<<mx2<<" "<<mx3<<" "<<mx4<<endl;
  104. mx =max(mx,max(mx1,max(mx2,max(mx3,mx4)))) ;
  105. //cout<<mx<<endl;
  106.  
  107.  
  108. }
  109. }
  110. }
  111.  
  112. }
  113. cout<<mx<<endl;
  114. tot+=mx;
  115. cerr<<"-------\n";
  116. }
  117. cout<<tot<<endl;
  118.  
  119.  
  120. }
Advertisement
Add Comment
Please, Sign In to add comment