Variable Sized Arrays

  • + 0 comments

    The question was tricky and a bit hard to understand it was difficult to understand the k maybe bcz i am just a beginner int N, Q; cin >> N >> Q;

    int* arr[N];
    
    for(int i = 0; i < N; i++ ){
        int k;
        cin >> k;
        arr[i] = new int[k];
        for(int j = 0; j < k; j++){
            cin >> arr[i][j];
        }
    }
    for(int i = 0; i < Q; i++){
        int a, b;
        cin >> a >> b;
        cout << arr[a][b] << endl;
    }