I'm doing some exercise online, so I have some problems.
I don't know where is problem in my code. It's return Segmentation fault
when I run code!
My code below:
#include <iostream>
using namespace std;
int main() {
int n, q, buff;
int k[100000], i[100000], j[100000], a[100000][300000];
int c;
cin >> n >> q;
for(buff=0; buff<n; buff++) {
cin >> k[buff];
//array
for(c = 0;c < k[buff]; c++) {
cin >> a[buff][c]; // <-- I think problem is here!
}
}
for(buff = 0; buff < q; buff++) {
cin >> i[buff];
}
for(buff = 0; buff < q; buff++) {
cin >> j[buff];
}
return 0;
}
Please help me! Sorry for my english.