You have the following declarations.
int employee = 5;
int time = 5;
n=5;
m=5;
Then you initialize F
array using--
for(int a = 0; a < employee; a++){
F[a] = new int [time];
for(int b = 0; b < time; b++){
F[a][b]=rand()%2;
Then you access it using--
for(int i=1; i<=n; i++){ //Each xi
for(int j=1; j<=m; j++){ //Each yj
if(F[i][j] ==0){
So you are out of bounds by 1
. Your loop should be
for(int i=0 i<n; i++){ //Each xi
for(int j=0; j<m; j++){ //Each yj
Suggestions:
Please use
std::vector
or some other container (suggested byBasile Starynkevitch
)Please name your variables better (which are easy to understand and remember)
Please be consistent in the variables you use in the loops, you will forget less about bounds.
Hope this helps.