Created
January 1, 2022 11:42
-
-
Save suryansh011/e149075b2f56288f678eb17f70773429 to your computer and use it in GitHub Desktop.
Variable Sized Arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cmath> | |
#include <cstdio> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int main() { | |
int n{}, q{}; | |
cin >> n >> q; | |
vector <vector<int>> a; | |
for(int i = 0; i < n; ++i) { | |
a.push_back(vector<int>()); | |
int k{}; | |
cin >> k; | |
for(int j = 0; j < k; ++j) { | |
int m; | |
cin >> m; | |
a[i].push_back(m); | |
} | |
} | |
for(int i = 0; i < q; ++i) { | |
int p{}, q{}; | |
cin >> p >> q; | |
cout << a.at(p).at(q) << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment