SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <unordered_map>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int t; cin >> t;
  9.    
  10.     while (t--)
  11.     {
  12.         int n; cin >> n;
  13.         unordered_map<pair<string, pair<int, int>>>mp;
  14.        
  15.         for (int i = 0; i < 0; ++i)
  16.         {
  17.             string a;
  18.             int b;
  19.            
  20.             cin >> a >> b;
  21.            
  22.             if (mp.find(a) == mp.end())
  23.             {
  24.                 if (b == 0)mp.insert(make_pair(a, make_pair(1, 0)));
  25.                 else mp.insert(make_pair(a, make_pair(0, 1)));
  26.             }
  27.            
  28.             else
  29.             {
  30.                 if (b == 0)mp[a].first++;
  31.                 else mp[a].second++;
  32.             }
  33.         }
  34.        
  35.         int ans = 0;
  36.        
  37.         for (auto x : mp)
  38.         {
  39.             ans += max(mp[a].first, mp[a].second);
  40.         }
  41.        
  42.         cout << ans << endl;
  43.     }
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top