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.
couldn't get what the problem mean until i saw the comment.
used 2d vector for the first time.
didn't know can specify vector as a data type
#include<cmath>#include<cstdio>#include<vector>#include<iostream>#include<algorithm>usingnamespacestd;intmain(){/* Enter your code here. Read input from STDIN. Print output to STDOUT */intn,q;cin>>n>>q;vector<vector<int>>data;vector<int>row_data;intinput;for(intcounter=0;counter<n;counter++){inti;cin>>i;row_data.clear();for(intcounter2=0;counter2<i;counter2++){cin>>input;row_data.push_back(input);}data.push_back(row_data);}introw,column;for(intcounter=0;counter<q;counter++){cin>>row>>column;cout<<data[row][column]<<"\n";}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Variable Sized Arrays
You are viewing a single comment's thread. Return to all comments →
couldn't get what the problem mean until i saw the comment.
used 2d vector for the first time. didn't know can specify vector as a data type