We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I did it this way. passed all tests. Seems to be cleaner than other solutions here.
intmain(){/* Enter your code here. Read input from STDIN. Print output to STDOUT */intn,q,k,i,j;cin>>n>>q;vector<vector<int>>arr(n);for(i=0;i<n;++i){cin>>k;arr[i].resize(k);for(j=0;j<k;++j){cin>>arr[i][j];}}for(intl=0;l<q;++l){cin>>i>>j;cout<<arr[i][j]<<endl;}return0;}
Variable Sized Arrays
You are viewing a single comment's thread. Return to all comments →
I did it this way. passed all tests. Seems to be cleaner than other solutions here.