hackerrank.com
Problem Link : https://www.hackerrank.com/challenges/variable-sized-arrays/problem?h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen
#include <iostream>
#include <vector>
using namespace std;
int main() {
int lenVector, lenQuery;
cin >> lenVector;
cin >> lenQuery;
vector<vector<int>> vs(lenVector);
for (int i = 0; i < lenVector; ++i) {
int n;
cin >> n;
for (int ii = 0; ii < n; ++ii) {
int t;
cin >> t;
vs[i].push_back(t);
}
}
while (lenQuery > 0) {
int i, j;
cin >> i >> j;
cout << vs[i][j] << '\n';
--lenQuery;
}
return 0;
}