You are viewing a single comment's thread. Return to all comments →
int main() { long n,q; int k[100000],a[100000][300000]; cin >> n >> q; for(int i = 0; i < n; i++) { cin >> k[i]; for(int j = 0; j < k[i]; j++) { cin >> a[i][j]; } } long x[100000],y[100000]; for(int i = 0; i < q; i++) { cin >> x[i] >> y[i]; cout << a[x[i]][y[i]] << endl; } return 0; }
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 →
int main() { long n,q; int k[100000],a[100000][300000]; cin >> n >> q; for(int i = 0; i < n; i++) { cin >> k[i]; for(int j = 0; j < k[i]; j++) { cin >> a[i][j]; } } long x[100000],y[100000]; for(int i = 0; i < q; i++) { cin >> x[i] >> y[i]; cout << a[x[i]][y[i]] << endl; } return 0; }