Buggy python submission (verdict: Time Limit Exceeded):

N=int(input().strip())
T=list(map(int,input().split()))
V=list(map(int,input().split()))
# 解説読んだ後
def get_maxspeed(left,right,vmax):
    def maxspeed(t):
        if t<=left:
            return vmax+(left-t)
        elif left< t < right:
            return vmax
        else:
            return vmax+t-right
    return maxspeed
funcs=[]
funcs.append(get_maxspeed(0,0,0))
left=0
for i in range(N):
    funcs.append(get_maxspeed(left,left+T[i],V[i]))
    left+=T[i]
funcs.append(get_maxspeed(left,left,0))
dist=0.0
speed=0
t=0
while t<=left:
    speed2=min(fc(t) for fc in funcs)
    if 0< t:
        dist+=(speed+speed2)*0.5/2
    speed=speed2
    t+=0.5
print(dist)

Fixed submission:
N=int(input().strip())
T=list(map(int,input().split()))
V=list(map(int,input().split()))
vtmax=[0]
tmp=0
Tsum=sum(T)
for t,v in zip(T,V):
    vtmax[-1]=min(tmp,v) #境界は小さい方が制約
    vtmax+=[v]*(t*2)
    tmp=v
vtmax[-1]=0

for i in range(1,2*Tsum):
    vtmax[i]=min(vtmax[i],vtmax[i-1]+0.5)
for i in range(2*Tsum-1,0,-1):
    vtmax[i]=min(vtmax[i],vtmax[i+1]+0.5)
area=0
for i,vt in enumerate(vtmax):
    if i==0:continue
    area+=0.5*(vt+vtmax[i-1])/2
print(area)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input().strip())
T=list(map(int,input().split()))
V=list(map(int,input().split()))
# 解説読んだ後
def maxspeed(left,right,t,vmax):
    if t<=left:
        return vmax+(left-t)
    elif left< t < right:
        return vmax
    else:
        return vmax+t-right
funcs=[]
funcs.append((0,0,0))
left=0
for i in range(N):
    funcs.append((left,left+T[i],V[i]))
    left+=T[i]
funcs.append((left,left,0))
dist=0.0
speed=0
t=0
while t<=left:
    speed2=min(maxspeed(pm[0],pm[1],t,pm[2]) for pm in funcs)
    if 0< t:
        dist+=(speed+speed2)*0.5/2
    speed=speed2
    t+=0.5
print(dist)

Fixed submission:
N=int(input().strip())
T=list(map(int,input().split()))
V=list(map(int,input().split()))
vtmax=[0]
tmp=0
Tsum=sum(T)
for t,v in zip(T,V):
    vtmax[-1]=min(tmp,v) #境界は小さい方が制約
    vtmax+=[v]*(t*2)
    tmp=v
vtmax[-1]=0

for i in range(1,2*Tsum):
    vtmax[i]=min(vtmax[i],vtmax[i-1]+0.5)
for i in range(2*Tsum-1,0,-1):
    vtmax[i]=min(vtmax[i],vtmax[i+1]+0.5)
area=0
for i,vt in enumerate(vtmax):
    if i==0:continue
    area+=0.5*(vt+vtmax[i-1])/2
print(area)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N=int(input().strip())
T=list(map(int,input().split()))
V=list(map(int,input().split()))
# 解説読んだ後
def maxspeed(left,right,t,vmax):
    if t<=left:
        return vmax+(left-t)
    elif left< t < right:
        return vmax
    else:
        return vmax+t-right
funcs=[]
funcs.append((0,0,0))
left=0
for i in range(N):
    funcs.append((left,left+T[i],V[i]))
    left+=T[i]
funcs.append((left,left,0))
dist=0.0
speed=0
for t in np.arange(0.0,left+0.5,0.5):
    speed2=min(maxspeed(pm[0],pm[1],t,pm[2]) for pm in funcs)
    if 0< t:
        dist+=(speed+speed2)*0.5/2
    speed=speed2
print(dist)

Fixed submission:
N=int(input().strip())
T=list(map(int,input().split()))
V=list(map(int,input().split()))
vtmax=[0]
tmp=0
Tsum=sum(T)
for t,v in zip(T,V):
    vtmax[-1]=min(tmp,v) #境界は小さい方が制約
    vtmax+=[v]*(t*2)
    tmp=v
vtmax[-1]=0

for i in range(1,2*Tsum):
    vtmax[i]=min(vtmax[i],vtmax[i-1]+0.5)
for i in range(2*Tsum-1,0,-1):
    vtmax[i]=min(vtmax[i],vtmax[i+1]+0.5)
area=0
for i,vt in enumerate(vtmax):
    if i==0:continue
    area+=0.5*(vt+vtmax[i-1])/2
print(area)