chef and strange matrix wrong answer is there any way to see which tst case failed?

Thanks for all your work, really fun to participate, even if I miss of bandwidth.
I’ll like to understand why my code fails with WA, so is it possible to get the test case which failed?
submission 3896408 or 3896404, I have some doubt on my tree walk.
For sure I missed something.

Thanks
Laurent

try this case…

1 4 3
1 1
1 1
1 4

ans should be -1…urs is mostly giving 2!!!

1 Like

ok found my mistake thanks!

in fact found 1 bug, but there is still some apparently 3900520

Just an idea which worked well for me to find my bugs after the challenge end:
I use the following program to generate examples, and compare the result between a valid program and mine.

//gentest.c

main(int c, char**v)
{
  unsigned int n;
  unsigned int m;
  unsigned int i,j;
  unsigned int p;

  i=atoi(v[1])*(rand()&0x7fff);
  n=i/32768+1;
  i=atoi(v[2])*(rand()&0x7fff);
  m=i/32768+1;
  p=atoi(v[3]);
  printf("%lu %lu %lu\n",n,m,p);
  while (p--)
  {
     i=((rand()&0x7fff)*n)/32768+1;
     j=((rand()&0x7fff)*m)/32768+1;
     printf("%lu %lu\n",i,j);
  }
}

then I to compare the result of 2 I use the following script:

while :
do
 for p in 1 10 100000
 do
     for i in 1 10 100000
`   `do
       for p in 1 10 100000
`     `do

  ./gentest $i $j $p >ta1;
  ./chefbm1 <ta1 >tr1; 
  ./chefbm2 <ta1 >tr2;
  diff tr1 tr2; if [ $? != 0 ];  then  break; fi; 
done
done
done
done

When it stops you have the test case you need in ta1.

1 Like