You are viewing a single comment's thread. Return to all comments →
long int ans= (n*(n-1))/2; for(auto it = m.begin(); it!= m.end(); it++){ long int astros = it->second; if(astros > 1) ans-= (astros*(astros-1))/2; } return ans;
long int ans= (n*(n-1))/2;
for(auto it = m.begin(); it!= m.end(); it++){ long int astros = it->second; if(astros > 1) ans-= (astros*(astros-1))/2; } return ans;
Seems like cookies are disabled on this browser, please enable them to open this website
Journey to the Moon
You are viewing a single comment's thread. Return to all comments →