fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6.  
  7. int main() {
  8. int **arr, arrqtd, queries;
  9.  
  10. cin >> arrqtd >> queries;
  11.  
  12. arr = (int **) malloc(sizeof(int*)*arrqtd);
  13. for (int i = 0; i < arrqtd;i++){
  14. int size;
  15.  
  16. cin >> size;
  17. arr[i] = (int *) malloc(sizeof(int)*size);
  18.  
  19. for(int j = 0; j < size;j++){
  20. int value;
  21. cin >> value;
  22. arr[i][j] = value;
  23. }
  24. }
  25.  
  26. for (int i = 0; i < queries;i++){
  27. int row,col;
  28. cin >> row >> col;
  29. cout << arr[row][col] << endl;
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0s 4364KB
stdin
10 10
3 916135 272188 794963
3 178997 502468 671251
1 122266
3 223511 996043 990104
3 319694 335208 200789
2 867809 273793
1 925358
1 71140
1 862238
1 994309
6 0
5 0
5 0
7 0
5 0
6 0
3 2
3 1
0 0
9 0
stdout
925358
867809
867809
71140
867809
925358
990104
996043
916135
994309