Why is my code giving a compilation error?
I want to have a multiset that can contain 3 items in a sorted order of the first item, if there is a tie then the second item, if there is again a tie then the third item.
Please suggest me a solution or any other data structure.
int main()
{
int n;
cin >> n ;
multiset<int, pair<int, int>> m;
for(int i = 0 ; i < n ;i++)
{
int a, b, c ;
cin >> a >> b >> c;
pair<int, int> p1 = make_pair(b, c) ;
pair<int, pair<int, int>> p2 = make_pair(a, p1) ;
m.insert(p2) ;
}
for(auto it = m.begin() ; it != m.end() ;it++)
{
cout << it->first << " " << it->second.first << " " << it->second.second << endl;
}
return 0;
}