Variable Sized Arrays

  • + 0 comments

    int main() {

    int n,q;
    cin >> n >> q;
    vector<vector<int>>v(n);
    for(int i = 0; i < n;i++){
        int nums;
        cin >> nums;
        v[i].resize(nums);
        for(int j = 0; j < nums;j++){
            int x;
            cin >> x;
            v[i][j] = x;
        }     
    }
    while(q--){
        int a,b;
        cin >> a >> b;
        cout << v[a][b]<<endl;
    } 
    return 0;
    

    }