https://www.acmicpc.net/problem/9375
풀이
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int main()
{
int CntCase{}, CntClothes{};
cin >> CntCase;
for (int i{}; i < CntCase; ++i)
{
cin >> CntClothes;
unordered_map<string, int> UmClothes;
string StrClothes{}, StrClothesCategory{};
for (int j{}; j < CntClothes; ++j)
{
cin >> StrClothes >> StrClothesCategory;
++UmClothes[StrClothesCategory];
}
int Sum{1};
for (auto& Clothes : UmClothes)
{
Sum *= (Clothes.second + 1);
}
cout << Sum - 1 << '\n';
}
return 0;
}