Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main()
- {
- int t;
- ll ans=0;
- cin>>t;
- while(t--)
- {
- ll n;
- cin>>n;
- cin.ignore();
- char s;
- ll x;
- ll arr[6][6]= {0};
- for(int i=0; i<n; i++)
- {
- cin>>s>>x;
- arr[ s-'A'][ (x/3)-1]+=1;
- }
- ll sum=-1e9-1;
- for(int i=0; i<4; i++)
- {
- vector <ll> v1;
- v1.push_back(arr[0][i]);
- for(int j=0; j<4; j++)
- {
- if(i==j)
- continue;
- vector<ll> v2(v1);
- v2.push_back(arr[1][j]);
- for(int k=0; k<4; k++)
- {
- if(k==i || k==j)
- continue;
- vector<ll> v3(v2);
- v3.push_back(arr[2][k]);
- for(int l=0; l<4; l++)
- {
- if(l==i || l==j || l==k)
- continue;
- vector <ll> v4(v3);
- v4.push_back(arr[3][l]);
- sort(v4.rbegin(),v4.rend());
- ll cnt=0;
- ll lose=0;
- cnt+=(v4[0]*100);
- cnt+=(v4[1]*75);
- cnt+=(v4[2]*50);
- cnt+=(v4[3]*25);
- for(int m=0; m<4; m++)
- {
- if(v4[m]==0)
- lose++;
- }
- lose*=100;
- cnt-=lose;
- sum=max(sum,cnt);
- }
- }
- }
- }
- cout<<sum<<endl;
- ans+=sum;
- }
- cout<<ans<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment