Objets/Documentation
longueurs28.py
Effet d’une rupture de plus sur cinq tours · longueurs28.py
Télécharger ↓"""Three turns, dwell two. Compare transfer with explicitly enumerated switch schedules."""
from collections import Counter,defaultdict
from functools import lru_cache
from itertools import combinations,product
import json
@lru_cache(None)
def runs(turns,start,a,b,c,k):
ordered=sorted((6*n+(start+j)%6,j) for j,group in enumerate((a,b,c)) for n in group)
end=changes=0
for (t,i),(s,j) in zip(ordered,ordered[1:]):
if i!=j:
changes+=1;end=max(end+2,t+1)
if changes>k or end>s:return False