This piece of code is not using the stl pair but vector of vector.
I am not able to understand how it is taking a pair as input that too with only one "cin"
K is the number of pairs to be input
1 2 3 4 5 6 7 8 9 10
vector<vector<int>> obstacles(k);
for (int i = 0; i < k; i++) {
obstacles[i].resize(2);
for (int j = 0; j < 2; j++) {
cin >> obstacles[i][j];
}
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
> I am not able to understand how it is taking a pair as input that too with only one "cin"
You have a cin inside a for loop which iterates twice.
How is that not a 'pair' of values.