Skip to main content
deleted 65 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 15 14 1312 bytes

εDO5÷FR]{`εDO5÷FR]`-Pd

-1 byte2 bytes thanks to @Neil.

Try it onlineTry it online or verify all test casesverify all test cases.

Explanation:

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 {       # Sort the list of pairs from lowest to highest
  `       # Pop and push both pairs separated to the stack
   -      # Subtract the values of the pairs from one another at the same indices
    P     # Take the product of those two values
     d    # And check that it's non-negative / >=0 (thus no score is decreasing)
         # (after which the result is output implicitly)

05AB1E, 15 14 13 bytes

εDO5÷FR]{`-Pd

-1 byte thanks to @Neil.

Try it online or verify all test cases.

Explanation:

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 {       # Sort the list of pairs from lowest to highest
  `      # Pop and push both pairs separated to the stack
   -     # Subtract the values of the pairs from one another at the same indices
    P    # Take the product of those two values
     d   # And check that it's non-negative / >=0 (thus no score is decreasing)
         # (after which the result is output implicitly)

05AB1E, 15 14 12 bytes

εDO5÷FR]`-Pd

-2 bytes thanks to @Neil.

Try it online or verify all test cases.

Explanation:

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 `       # Pop and push both pairs separated to the stack
  -      # Subtract the values of the pairs from one another at the same indices
   P     # Take the product of those two values
    d    # And check that it's non-negative / >=0 (thus no score is decreasing)
         # (after which the result is output implicitly)
deleted 1013 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 15 14 14 13 bytes

εDO5÷FR]{øÆ1‹P`-Pd

Try it online or-1 byte thanks to verify all test cases@Neil.

A minor alternative: FR]{øÆ1‹P could be ._}{R`-dß for the same byte-count:

Try it onlineTry it online or verify all test casesverify all test cases.

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 {       # Sort the list of pairs from lowest to highest
  ø      # Zip/transpose; swapping rows/columns
   Æ     # Reduce each inner pair by subtracting
    1‹   # Check for both values if they're smaller than 1 (thus no score is decreasing)
      P  # And check if both are truthy by taking the product
         # (after which the result is output implicitly)

εDO5÷    # Same as above
     ._  #  Rotate the pair that many times towards the left
         #  (the pair is reversed for odd sums; and remains unchanged for even sums)
}{R      # After the map: sort the list of pairs from highest to lowest
   `      # Pop and push both pairs separated to the stack
    -     # Subtract the values of the pairs from one another at the same indices
    P d   # Check for each value if it's non-negative /Take >=0the (thusproduct noof scorethose istwo decreasing)values
     d ß  # And check ifthat bothit's arenon-negative truthy/ by>=0 taking(thus theno minimumscore is decreasing)
         # (after which the result is output implicitly)

05AB1E, 15 14 bytes

εDO5÷FR]{øÆ1‹P

Try it online or verify all test cases.

A minor alternative: FR]{øÆ1‹P could be ._}{R`-dß for the same byte-count:

Try it online or verify all test cases.

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 {       # Sort the list of pairs from lowest to highest
  ø      # Zip/transpose; swapping rows/columns
   Æ     # Reduce each inner pair by subtracting
    1‹   # Check for both values if they're smaller than 1 (thus no score is decreasing)
      P  # And check if both are truthy by taking the product
         # (after which the result is output implicitly)

εDO5÷    # Same as above
     ._  #  Rotate the pair that many times towards the left
         #  (the pair is reversed for odd sums; and remains unchanged for even sums)
}{R      # After the map: sort the list of pairs from highest to lowest
   `     # Pop and push both pairs separated to the stack
    -    # Subtract the values of the pairs from one another at the same indices
     d   # Check for each value if it's non-negative / >=0 (thus no score is decreasing)
      ß  # And check if both are truthy by taking the minimum
         # (after which the result is output implicitly)

05AB1E, 15 14 13 bytes

εDO5÷FR]{`-Pd

-1 byte thanks to @Neil.

Try it online or verify all test cases.

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 {       # Sort the list of pairs from lowest to highest
  `      # Pop and push both pairs separated to the stack
   -     # Subtract the values of the pairs from one another at the same indices
    P    # Take the product of those two values
     d   # And check that it's non-negative / >=0 (thus no score is decreasing)
         # (after which the result is output implicitly)
added 1050 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 15 14 bytes

εDO5÷FR]{øÆ1‹P

Try it online or verify all test cases.

A minor alternative: FR]{øÆ1‹P could be ._}{R`-dß for the same byte-count:

Try it online or verify all test cases.

Explanation:

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 {       # Sort the list of pairs from lowest to highest
  ø      # Zip/transpose; swapping rows/columns
   Æ     # Reduce each inner pair by subtracting
    1‹   # Check for both values if they're smaller than 1 (thus no score is decreasing)
      P  # And check if both are truthy by taking the product
         # (after which the result is output implicitly)

εDO5÷    # Same as above
     ._  #  Rotate the pair that many times towards the left
         #  (the pair is reversed for odd sums; and remains unchanged for even sums)
}{R      # After the map: sort the list of pairs from highest to lowest
   `     # Pop and push both pairs separated to the stack
    -    # Subtract the values of the pairs from one another at the same indices
     d   # Check for each value if it's non-negative / >=0 (thus no score is decreasing)
      ß  # And check if both are truthy by taking the minimum
         # (after which the result is output implicitly)

05AB1E, 15 14 bytes

εDO5÷FR]{øÆ1‹P

Try it online or verify all test cases.

Explanation:

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 {       # Sort the list of pairs from lowest to highest
  ø      # Zip/transpose; swapping rows/columns
   Æ     # Reduce each inner pair by subtracting
    1‹   # Check for both values if they're smaller than 1 (thus no score is decreasing)
      P  # And check if both are truthy
         # (after which the result is output implicitly)

05AB1E, 15 14 bytes

εDO5÷FR]{øÆ1‹P

Try it online or verify all test cases.

A minor alternative: FR]{øÆ1‹P could be ._}{R`-dß for the same byte-count:

Try it online or verify all test cases.

Explanation:

ε        # Map both pairs in the (implicit) input to:
 D       #  Duplicate the pair
  O      #  Pop this duplicate and calculate its sum
   5÷    #  Integer-divide it by 5
     F   #  Loop that many times:
      R  #   Reverse the pair every iteration
         #   (the pair is reversed for odd sums; and remains unchanged for even sums)
]        # Close both the loop and map
         # (all pairs are now in the order [A,B])
 {       # Sort the list of pairs from lowest to highest
  ø      # Zip/transpose; swapping rows/columns
   Æ     # Reduce each inner pair by subtracting
    1‹   # Check for both values if they're smaller than 1 (thus no score is decreasing)
      P  # And check if both are truthy by taking the product
         # (after which the result is output implicitly)

εDO5÷    # Same as above
     ._  #  Rotate the pair that many times towards the left
         #  (the pair is reversed for odd sums; and remains unchanged for even sums)
}{R      # After the map: sort the list of pairs from highest to lowest
   `     # Pop and push both pairs separated to the stack
    -    # Subtract the values of the pairs from one another at the same indices
     d   # Check for each value if it's non-negative / >=0 (thus no score is decreasing)
      ß  # And check if both are truthy by taking the minimum
         # (after which the result is output implicitly)
added 79 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading