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.
int N;
int Q;
cin >> N >> Q;
int** arr = new int*[N];
for (int i = 0; i> l;
arr[i] = new int[l];
int tmp;
for (int j= 0; j> tmp;
arr[i][j] = tmp;
}
}
int** arr1 = new int*[Q];
for (int i = 0; i> tmp;
arr1[i][j] = tmp;
}
}
for (int i = 0; i < Q; i++)
{
cout << arr[arr1[i][0]][arr1[i][1]] << endl;
}
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 →
int N; int Q; cin >> N >> Q; int** arr = new int*[N]; for (int i = 0; i> l; arr[i] = new int[l]; int tmp; for (int j= 0; j> tmp; arr[i][j] = tmp; } } int** arr1 = new int*[Q]; for (int i = 0; i> tmp; arr1[i][j] = tmp; } } for (int i = 0; i < Q; i++) { cout << arr[arr1[i][0]][arr1[i][1]] << endl; }