SAKTAN - Editorial

hi if you are facing issues with the problem of not passing the third test case try changing
int -> long
hope it helps

1 Like

@anon76214830 Use long long instead of int for storing all variable

#include<stdio.h>
#include<stdlib.h>

int r,c;
void multiarray(int array[r][c],int x,int y,int row,int col)
{
for(int i=0;i<col;i++){
array[x][i]=array[x][i]+1;
}
for(int j=0;j<row;j++){
array[j][y]=array[j][y]+1;
}
}

int main()
{

int T,Q;
int x,y;
int count=0;
scanf("%d",&T);
while(T!=0)
{
    scanf("%d%d%d",&r,&c,&Q);
    int mult[r][c];
    memset( mult, 0, r*c*sizeof(int) );

    while(Q!=0)
    {
        scanf("%d%d",&x,&y);
        multiarray(mult,x-1,y-1,r,c);
        Q--;
    }
    for(int i=0;i<r;i++)
    {
        for(int j=0;j<c;j++)
        {
            if(mult[i][j]%2 != 0)
            {
                count++;
            }
        }
    }
    printf("%d",count);
    T--;
}

return 0;

}

what’s the problem in this code??? works fine in codeblocks!!!
pls ans!!