- Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathvariable-sized-arrays.cpp
More file actions
Latest commit
40 lines (33 loc) · 783 Bytes
/
Copy pathvariable-sized-arrays.cpp
File metadata and controls
40 lines (33 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Variable Sized Arrays
// Find the element described in the query for integer sequences.
//
// https://www.hackerrank.com/challenges/variable-sized-arrays/problem
//
#include<cmath>
#include<cstdio>
#include<vector>
#include<iostream>
#include<algorithm>
usingnamespacestd;
intmain() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
vector<vector<int>> w;
int n, q;
cin >> n >> q;
while (n-- != 0)
{
size_t k;
int x;
vector<int> v;
cin >> k;
while (k-- != 0) { cin >> x; v.push_back(x); }
w.push_back(v);
}
while (q-- != 0)
{
size_t i, j;
cin >> i >> j;
cout << w[i][j] << endl;
}
return0;
}