Variable Sized Arrays

  • + 0 comments

    int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    int n, q , k , l , pl , pt; cin >> n >> q ; vector> num(n);

    for (int i = 0 ; i <= n - 1 ; i++ ){
        cin >> k ;
        num[i].resize(k);
        for (int j = 0 ; j < k ; j++ )
        {
            cin >> num[i][j] ;
        }
    }
    
    for (int i = 0 ; i < q ; i++){
        cin >> pl >> pt ;
        cout << num[pl][pt] << "\n";
    }
    
    return 0;
    

    }