Std::pair problem

If p is an array of pairs what is this line doing ?

for(int i=0; i<n; i++) {
        if(p[i]==p[k-1]) ans++;
    }

This is what the if(condition) breaks down to.

if(p[i].first()==p[k-1].first() && p[i].second()==p[k-1].second())
 ans++;
1 Like