----ITA----
Salve a tutti, volevo chiedere se qualcuno è riuscito a svolgere l'ordinamento dei rettangoli, per ora ho fatto delle prove ma non riesco a passare 3 test.
Per eseguire questa operazione, creo un dizionario con dentro come chiave il colore, e come valori la lista di colori che intersecano quest'ultimo(la chiave).
Ho pensato di comporre una lista partendo dalla chiave che ha un valore vuoto, ovvero quello più in alto, per poi inserire altri colori (quindi le chiavi )solamente se i valori ad essi associati (quindi il valore) contengono tutti i colori già caricati nella lista.
ripeto: l'algoritmo funziona ma fallisce 3 test, che controllo mi manca o mi sfugge? è corretto dire che ogni rettangolo a un suo livello e non possono esserci 2 rettangoli allo stesso livello?
----ENG----
Hi everyone, I wanted to ask if anyone has managed to carry out the sorting of the rectangles, for now I have done some tests but I can not pass 3 tests.
To do this, I create a dictionary with the color as key, and as values the list of colors that intersect the latter (the key).
I decided to compose a list starting from the key that has an empty value, that is the highest value, and then insert other colors (therefore the keys) only if the values associated with them (therefore the value) contain all the colors already loaded in the list.
I repeat: the algorithm works but fails 3 tests, which control am I missing or escaping me? Is it correct to say that each rectangle has its own level and there cannot be 2 rectangles at the same level?