Created
February 21, 2019 21:24
-
-
Save roxsula/5c779b0999c5c5540067be9662a5f965 to your computer and use it in GitHub Desktop.
Vector of Vectors in C++
This file contains 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() { | |
/* Enter your code here. Read input from STDIN. Print output to STDOUT */ | |
int n, q; | |
cin >> n >> q; | |
vector<vector<int>> arr(n); | |
for(int i=0; i<n; i++) | |
{ | |
int k = 0; | |
cin >> k; | |
arr[i].resize(k); | |
for(int j=0; j<k; j++) cin >> arr[i][j]; | |
} | |
for(int m=0; m<q; m++) | |
{ | |
int a = 0; | |
int b = 0; | |
cin >> a >> b; | |
cout << arr[a][b] << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment