You are viewing a single comment's thread. Return to all comments →
I don't know vector and dynamic arrays.... How to proceed without it... I know the logic, it is only that runtime error comes...
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; }
Variable Sized Arrays
You are viewing a single comment's thread. Return to all comments →
I don't know vector and dynamic arrays.... How to proceed without it... I know the logic, it is only that runtime error comes...
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; }