dimanche 29 janvier 2017

Why my code is not working and showing Segmentation Fault error?

#include <iostream>
using namespace std;

int main() {
    long n, q, i, j, k, l, arr[100000][300000];
    cin >> n>>q;
    for(i=0; i<n; i++)
    {
        cin >> k;
        for(j=0; j<k; j++)
            cin >> arr[i][j];
    }
    for(l=0; l<q; l++)
        {
        cin >> i>>j;
        cout << arr[i][j]<<endl;
    }
    return 0;
}

I am trying to solve Variable Sized Arrays problem.

here is the link of the problem

Aucun commentaire:

Enregistrer un commentaire