27
Nikita Melentev
Last seen 7 months ago
Member for 10 years, 21 days
Difficulty Normal
"exclusive": lambda x,y: (x or y) and not (x and y)
It's just
"exclusive": lambda x,y: x ^ y
More
> Interestingly, size 6 case is better performance than size 4
Probably 6 case have relativly more solutions. Nice idea, but hard to understand realisation for me %)
More
Heh, my solution have same idea, but with some extra additions:
* When you write "a in self.connections[b]" with defaultdict you actually create an empty 'defaultcontainer' (set in this case) if there was no container for this key. So garbage will grow up.
* Definetly better to call self.add in \_\_
More
Awesome solution! 👏
Funny, that python have this module at all. Sometimes I think that standard library was made as:
— WOW, MAN, WE NEED THIS IN STDLIB RIGHT NOW!
— YEAH, DUDE!
But this can't be removed or refactored cause legacy. Since now only small part of stdlib is used as mainstream and eve
More
Instead of "i_and_r" you can use real args:
```
def keep_rings(lower, individuals, rings):
...
return max(keep_rings(*break_loop(True, individuals, rings)),
keep_rings(*break_loop(False, individuals, rings)))
```
Also you can return results without parenthesis:
```
return i
More
Based on idea that if a -> b (-> is gift direction) and this gift breaks the longest chain of chains, then we should check chain, which intersects with this chain. So, line 55 is this check. We take chain only if it intersect "base" chain (actually first random). The logic is if a -> b doesn't break
More