#include <iostream>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int num, qr, maxSize = 0;
cin >> num >> qr;
for (int i = 0; i < num; i++)
{
int size;
cin >> size;
if (size > maxSize)
{
maxSize = size;
}
}
int arr[num][maxSize];
for (int i = 0; i < num; i++)
{
int s;
cin >> s;
for (int j = 0; j < s; j++)
{
int elem;
cin >> elem;
arr[i][j] = elem;
}
}
for (int i = 0; i < qr; i++)
{
int a,b;
cin >> a >> b;
cout << arr[a][b];
}
return 0;
}
This code terminates giving Segmentation Fault Error. I am new to the world of C++ and I don't have any idea of this error message. Any help would mean a lot to me.
Aucun commentaire:
Enregistrer un commentaire