Skip to main content
deleted 80 characters in body
Source Link
Ajax1234
  • 9.2k
  • 1
  • 16
  • 30

Python3, 311255 bytes

def f(A,B):
 t,p,T,M=0,[],0,0t=T=M=0;p=[]
 while A and B:
  p+=[c:=[A,B][t].pop(0)]
  M+=1
  if c:
   l=t;T+=1];h=c>0;T+=h;t=[~t,t][h];M+=1
   while 1F:
    F=1=h:
    for _ inwhile range(c):
    if if[]==not(K:=[A=[B,B][not t]A][t]):return T,Mh=0;break
     p+=[C:=K.pop(0)];M+=1];M+=1;c-=1
     if C:F=0;l=not t;t=not t;c=C;breakF=0;t=~t;c=C;break
    if F:[A,B][l]+=p;p=[];t=l;break
  else:t=not tB][t]+=p;p=[];h=0
 return T,M

Try it online!Try it online!

Python3, 311 bytes

def f(A,B):
 t,p,T,M=0,[],0,0
 while A and B:
  p+=[c:=[A,B][t].pop(0)]
  M+=1
  if c:
   l=t;T+=1
   while 1:
    F=1
    for _ in range(c):
     if[]==(K:=[A,B][not t]):return T,M
     p+=[C:=K.pop(0)];M+=1
     if C:F=0;l=not t;t=not t;c=C;break
    if F:[A,B][l]+=p;p=[];t=l;break
  else:t=not t
 return T,M

Try it online!

Python3, 255 bytes

def f(A,B):
 t=T=M=0;p=[]
 while A and B:
  p+=[c:=[A,B][t].pop(0)];h=c>0;T+=h;t=[~t,t][h];M+=1
  while F:=h:
   while c:
    if not(K:=[B,A][t]):h=0;break
    p+=[C:=K.pop(0)];M+=1;c-=1
    if C:F=0;t=~t;c=C;break
   if F:[A,B][t]+=p;p=[];h=0
 return T,M

Try it online!

Source Link
Ajax1234
  • 9.2k
  • 1
  • 16
  • 30

Python3, 311 bytes

def f(A,B):
 t,p,T,M=0,[],0,0
 while A and B:
  p+=[c:=[A,B][t].pop(0)]
  M+=1
  if c:
   l=t;T+=1
   while 1:
    F=1
    for _ in range(c):
     if[]==(K:=[A,B][not t]):return T,M
     p+=[C:=K.pop(0)];M+=1
     if C:F=0;l=not t;t=not t;c=C;break
    if F:[A,B][l]+=p;p=[];t=l;break
  else:t=not t
 return T,M

Try it online!