Skip to main content
1 of 2
Nahuel Fouilleul
  • 8.6k
  • 1
  • 10
  • 18

Perl 5 -p, 77 bytes

/ (.*) (.*) /;$_=(($`+$1)/5%2^($2+$')/5%2?($`-$')*($1-$2):($`-$2)*($1-$'))>=0

Try it online!

Nahuel Fouilleul
  • 8.6k
  • 1
  • 10
  • 18