You are viewing a single comment's thread. Return to all comments →
using namespace std; int main() { int n, q, size, value, which, index; cin >> n >> q; vector> nvec; for (int i = 0; i < n; ++i) { cin >> size; vector ivec; for (int j = 0; j < size; ++j) { cin >> value; ivec.push_back(value); } nvec.push_back(ivec); } for (int k = 0; k < q; ++k) { cin >> which >> index; cout << nvec[which][index] << endl; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Variable Sized Arrays
You are viewing a single comment's thread. Return to all comments →
using namespace std; int main() { int n, q, size, value, which, index; cin >> n >> q; vector> nvec; for (int i = 0; i < n; ++i) { cin >> size; vector ivec; for (int j = 0; j < size; ++j) { cin >> value; ivec.push_back(value); } nvec.push_back(ivec); } for (int k = 0; k < q; ++k) { cin >> which >> index; cout << nvec[which][index] << endl; } return 0; }