Why is the following code not inserting elements in the map<int, set<int> >
?
(The size of all the sets after executing the following code is 0.)
I am creating an adjacency list in this map.
map<int, set<int> > m;
cin>>n;
while(n--)
{
cin>>t;
int i=0;
while(t--)
{
scanf("%d",&x);
set<int> s;
m[x] = s;
if(i != 0)
m[prev].insert(x);
prev = x;
}
}