petr_qwerty's blog

By petr_qwerty, history, 18 hours ago, In Russian

a=int(input()) b=int(input()) nk=0 k=0 critical=0 seconds=0 cm=[] sk=[] for i in range(a): c,d=map(int,input().split()) cm.append(c) sk.append(d) while(sum(cm)>0): seconds+=max(0,cm[k]-critical) cm[k]=0 critical=sk[k] k+=b if(k>len(cm)-1): nk+=1 k=nk critical=0 print(seconds)

  • Vote: I like it
  • 0
  • Vote: I do not like it