This question can be done usnig pairs but I don't know how to make several pairs simultaneously

like when we define pair in C++
we have to name it so that we can access its first and second element.
example:
pair <int, int> p1;
here p1 is the name of the pair

but if we want to make given numbers of pairs simultaneously how can we name them and access their first and second element.

Pardon me if we can’t use pairs in this Problem.

Hey @nikhilthechamp871
Use vector of pairs

vector<pair<int,int> > arr;
arr[i].first and arr[i].second inside loop to access them

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.