You are viewing a single comment's thread. Return to all comments →
I solved it using vector
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { int numArrays, numQueries; cin >> numArrays>> numQueries; vector<vector<int>> Arrays; for (int x=0; x<numArrays; x++){ int length; cin >> length; vector<int> arr; for (int ll = 0;ll<length;ll++){ int temp; cin >> temp; arr.push_back(temp); } Arrays.push_back(arr); } for (int count = 0; count<numQueries;count++){ int arrayCount, NumberIndex; cin >> arrayCount >> NumberIndex; cout << Arrays[arrayCount][NumberIndex] << 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 →
I solved it using vector