某仓库有一排连续相邻的货位,编号依次为 0~n-1,用于放置 A,B 两种类型的箱子,A型箱子占 2 个相邻货位,B 型箱子占 1 个货位。编写程序,根据已完成的放置或搬离操作,输出空货位数及还可放置 A 型箱子的最多数量(不移动已放置的箱子)。
n=int(input()) cnt1=n lst=[0]*n while True: t,d,s=input().split() s=int(s) if t=='A': w=2 __(1)____: w=1 else: break if d=='P': ____(2)______ else: cnt1+=w lst[s]=1-lst[s] if t=='A': lst[s+1]=1-lst[s+1] i,cnt2=0,0 while i<n-1: if lst[i]==0 and lst[i+1]==0: _____(3)_______ cnt2+=1 i+=1 print(cnt1,cnt2)