[Community Puzzle] Nature of quadrilaterals

I think that there is an incorrect test case for this community puzzle (it’s currently the puzzle of the week).
The last test case is:

06 Everything
3
H -4 3 A 2 5 R 4 2 D 10 4
J -2 0 A 0 1 C 2 0 K 0 -1
A 1 -2 B 5 0 C 3 4 D -1 2

HARD is a quadrilateral.
JACK is a rhombus.
ABCD is a square.

I drew the first first quadrilateral (HARD) and I think it should be expecting a parallelogram, not just quadrilateral, because it has two pairs of equal sides that are parallel with each to other.

I submitted my solution and got 100% score, even though it did not passed on this test case. If you already solved, I think you can have a look at my solution here.

I also checked some public solutions, could not find one that don’t successfully pass on the last test case as mine.

Seems in your picture. R and D is swapped? so in origin input, it’s a polygon intersects with itself

I had a look at the problem setter’s code. When I rearrange the points to HADR (as you drew them), the code calls it a parallelogram. On first thought that seems correct to me, I will have a closer look later.

Edit: too late

Nope, R(4;2), not R(10;4).

My mistake in the representation there, I see the the swapped points.

I assumed the quadrilateral is convex when reading that “You won’t have to test if a quadrilateral is degenerate or convex.”.

Searching for quadrilateral definions, this lead to my wrong implementation:
“Quadrilaterals are simple (not self-intersecting) or complex (self-intersecting), also called crossed. Simple quadrilaterals are either convex or concave.”

My bad. :cold_sweat:

There is a mistake in the test case. They say “You won’t have to test if a quadrilateral is degenerate or convex.” but this quadrilateral is not convex. Just check the vertex order.

It’s not a mistake, ABCD is not ABDC.

In the “HARD” case I see side AR crosses side DH. Am I wrong?

And what’s the problem? Do the diagonals HR and AD have the same middle point?

No, they do not cross! It’s just another prove that HARD is not convex. Its against the description of this puzzle, repeat again: “You won’t have to test if a quadrilateral is degenerate or convex.”

But all the programs managed this case, so the solutions are more general, and as we see, “convex” is not a demand to do right calculations.

So no problem… unless you try to draw a picture :slight_smile:

So, you have to test if HARD is a parallelogram, not if HADR or HRAD are parallelograms.
HARD is not convex? So what? It’s not a parallelogram.

Compare it with puzzle description:

Constraints
The coordinates are integers between -20 and 20, you have no more than 3 quadrilaterals.
You won’t have to test if a quadrilateral is degenerate or convex.

I mean HARD do not satisfy the constrains. I consider this as a mistake.
Most programs are lenient, they don’t need this constraint anyway, as we see.

And you are absolutely right: It’s not a parallelogram.

No need to use a hard theorem to test if it is convex or not, testing the middles of diagonals condition is enough to tell if it is a parallelogram or not.

Hi!
When i`m run latest test “Everything” in Rust lang it falls with an error message:

Console output
Standard Output Stream:

n = 3
i = 0
n = 0 line is H -4 3 A 2 5 R 4 2 D 10 4
HARD is a quadrilateral.
i = 1
n = 1 line is J -2 0 A 0 1 C 2 0 K 0 -1
JACK is a rhombus.

Failure
Found:
Nothing
Expected:
ABCD is a square.

It seems an error in parsing the input stream.

I don’t have a problem with my rust solution code.

I apologize, the error in the my code.
All ok. I’m use “return” instead “continue”

Bonjour à tous,

Pour ce puzzle, j’ai réussi tous les tests dans l’IDE mais 2 (Rhombus et everything) ne passent à la soumission.

Pour résoudre ce puzzle, j’ai choisi l’option Vecteur (avec 2 classes une Point et une autre vecteur)
La classe vecteur me permet de vérifier si deux vecteurs ont la même norme (longueur), s’ils sont colinéaires (parallèles) ou s’ils sont orthonormés (perpendiculaires).

J’avoue ne pas voir d’où peut venir le problème surtout que je n’ai aucun message d’explication sur la non validation…

Si quelqu’un a déjà rencontré le problème, je ne suis pas contre un coup de pouce…

Merci par avance à tous

Hi,

Problem is solved…

Thanks to Chingmann for his help.

1 Like

salut!

j’ai le même soucis pour la catégorie “everything”, si tu as une explication qui vaille pour mon problème, je t’en serais reconnaissant :stuck_out_tongue:

par contre j’ai tout codé à la crade dans la première boucle for…

merci d’avance!

Bonsoir,

Envoie ton code par message.
Je jeterai un coup d’oeil…

Bonne soirée