Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
- #define INF 0x3f3f3f3f3f
- int main() {
- fastio;
- ll test;
- cin >> test;
- for(ll t = 0; t < test; t++){
- ll n , b;
- string s;
- ll c = 0;
- map<string , pair<ll,ll> > m;
- cin >> n;
- for(ll i = 0; i < n; i++){
- cin >> s >> b;
- if(b == 0) m[s].first++;
- else m[s].second++;
- }
- for(auto x : m) c += max(x.second.first , x.second.second);
- cout << c << "\n";
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment