제출 #727004

#제출 시각아이디문제언어결과실행 시간메모리
727004beaconmcCoins (BOI06_coins)Pypy 3
90 / 100
837 ms41460 KiB
H=print
G=range
F=input
I,C=map(int,F().split())
A=[]
D=[]
for B in G(I):J,K=map(int,F().split());A.append(J);D.append(K)
E=0
sum=0
for B in G(len(A)-1):
	if D[B]==0 and sum+A[B]<A[B+1]and sum+A[B]<C:E+=1;sum+=A[B]
if sum+A[-1]<C and D[-1]==0:E+=1;sum+=A[-1]
H(E)
H(C-sum)
#Verdict Execution timeMemoryGrader output
Fetching results...