Решение на Навигация на Piet от Виктор

Обратно към всички решения

Към профила на Виктор

Резултати

  • 10 точки от тестове
  • 0 бонус точки
  • 10 точки общо
  • 8 успешни тест(а)
  • 0 неуспешни тест(а)

Код

def calculate_final_vector(init, hexes):
return tuple(map(sum,zip(init,tuple(map(sum,(zip(*[((((-1)**((_&2)//2+1))*((-1)**(int('f' in __))))+(int(_==15)), 0)[::(-1)**((_%(5+(_&8)))&1)] for hex in hexes[:(hexes+['000000']).index('000000')] for __ in (hex.lower(),) for _ in (int(str(int(('ff'*('f' in __)+__)[::2].replace('f','2').replace('c','1'))-1111*((sum(ord(c) for c in __)&32)//32)), base=2),)])))) or (0,0)))) # Sorry, not sorry

Лог от изпълнението

........
----------------------------------------------------------------------
Ran 8 tests in 0.151s

OK

История (4 версии и 0 коментара)

Виктор обнови решението на 18.10.2022 17:34 (преди над 1 година)

+def calculate_final_vector(init, hexes):
+ return tuple(map(sum,zip(init,tuple(map(sum,(zip(*[((((-1)**((_&2)//2+1))*((-1)**(int('f' in __))))+(int(_==15)), 0)[::(-1)**((_%(5+(_&8)))&1)] for hex in hexes[:(hexes+['000000']).index('000000')] for __ in (hex.lower(),) for _ in (int(str(int(('ff'*('f' in __)+__)[::2].replace('f','2').replace('c','1'))-1111*((sum(ord(c) for c in __)&32)//32)), base=2),)])))))))
+
+# Sorry, not sorry

Виктор обнови решението на 19.10.2022 18:55 (преди над 1 година)

def calculate_final_vector(init, hexes):
- return tuple(map(sum,zip(init,tuple(map(sum,(zip(*[((((-1)**((_&2)//2+1))*((-1)**(int('f' in __))))+(int(_==15)), 0)[::(-1)**((_%(5+(_&8)))&1)] for hex in hexes[:(hexes+['000000']).index('000000')] for __ in (hex.lower(),) for _ in (int(str(int(('ff'*('f' in __)+__)[::2].replace('f','2').replace('c','1'))-1111*((sum(ord(c) for c in __)&32)//32)), base=2),)])))))))
-
+ return tuple(map(sum,zip(init,tuple(map(sum,(zip(*[((((-1)**((_&2)//2+1))*((-1)**(int('f' in __))))+(int(_==15)), 0)[::(-1)**((_%(5+(_&8)))&1)] for hex in hexes[:(hexes+['000000']).index('000000')] for __ in (hex.lower(),) for _ in (int(str(int(('ff'*('f' in __)+__)[::2].replace('f','2').replace('c','1'))-1111*((sum(ord(c) for c in __)&32)//32)),base=2),)]))))))) # Sorry, not sorry
-# Sorry, not sorry

Виктор обнови решението на 25.10.2022 10:58 (преди над 1 година)

def calculate_final_vector(init, hexes):
- return tuple(map(sum,zip(init,tuple(map(sum,(zip(*[((((-1)**((_&2)//2+1))*((-1)**(int('f' in __))))+(int(_==15)), 0)[::(-1)**((_%(5+(_&8)))&1)] for hex in hexes[:(hexes+['000000']).index('000000')] for __ in (hex.lower(),) for _ in (int(str(int(('ff'*('f' in __)+__)[::2].replace('f','2').replace('c','1'))-1111*((sum(ord(c) for c in __)&32)//32)),base=2),)]))))))) # Sorry, not sorry
+ return tuple(map(sum,zip(init,tuple(map(sum,(zip(*[((((-1)**((_&2)//2+1))*((-1)**(int('f' in __))))+(int(_==15)), 0)[::(-1)**((_%(5+(_&8)))&1)] for hex in (hexes+['FFFFFF'])[:(hexes+['FFFFFF', '000000']).index('000000')] for __ in (hex.lower(),) for _ in (int(str(int(('ff'*('f' in __)+__)[::2].replace('f','2').replace('c','1'))-1111*((sum(ord(c) for c in __)&32)//32)), base=2),) ]))))))) # Sorry, not sorry

Виктор обнови решението на 25.10.2022 12:10 (преди над 1 година)

def calculate_final_vector(init, hexes):
- return tuple(map(sum,zip(init,tuple(map(sum,(zip(*[((((-1)**((_&2)//2+1))*((-1)**(int('f' in __))))+(int(_==15)), 0)[::(-1)**((_%(5+(_&8)))&1)] for hex in (hexes+['FFFFFF'])[:(hexes+['FFFFFF', '000000']).index('000000')] for __ in (hex.lower(),) for _ in (int(str(int(('ff'*('f' in __)+__)[::2].replace('f','2').replace('c','1'))-1111*((sum(ord(c) for c in __)&32)//32)), base=2),) ]))))))) # Sorry, not sorry
+ return tuple(map(sum,zip(init,tuple(map(sum,(zip(*[((((-1)**((_&2)//2+1))*((-1)**(int('f' in __))))+(int(_==15)), 0)[::(-1)**((_%(5+(_&8)))&1)] for hex in hexes[:(hexes+['000000']).index('000000')] for __ in (hex.lower(),) for _ in (int(str(int(('ff'*('f' in __)+__)[::2].replace('f','2').replace('c','1'))-1111*((sum(ord(c) for c in __)&32)//32)), base=2),)])))) or (0,0)))) # Sorry, not sorry