Skip to content

Instantly share code, notes, and snippets.

@elvinio
Last active March 19, 2016 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elvinio/5413118168873390317a to your computer and use it in GitHub Desktop.
Save elvinio/5413118168873390317a to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
int **seq;
int N, Q;
cin >> N;
cin >> Q;
//cout << N << " " << Q;
seq = new int*[N];
for(int i = 0; i<N; i++){
int x, y;
cin >> x;
//cout << " " << x;
int *seqs = new int[x];
for(int h=0; h<x; h++){
cin >> y;
seqs[h] = y;
}
seq[i] = seqs;
}
for(int i=0; i<Q; i++){
int a, b;
cin >> a;
cin >> b;
cout << seq[a][b] << "\n";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment