Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <unordered_map>
- using namespace std;
- int main()
- {
- int t; cin >> t;
- while (t--)
- {
- int n; cin >> n;
- unordered_map<pair<string, pair<int, int>>>mp;
- for (int i = 0; i < 0; ++i)
- {
- string a;
- int b;
- cin >> a >> b;
- if (mp.find(a) == mp.end())
- {
- if (b == 0)mp.insert(make_pair(a, make_pair(1, 0)));
- else mp.insert(make_pair(a, make_pair(0, 1)));
- }
- else
- {
- if (b == 0)mp[a].first++;
- else mp[a].second++;
- }
- }
- int ans = 0;
- for (auto x : mp)
- {
- ans += max(mp[a].first, mp[a].second);
- }
- cout << ans << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement