Submission #726996

#TimeUsernameProblemLanguageResultExecution timeMemory
726996beaconmcCoins (BOI06_coins)Pypy 3
90 / 100
906 ms41380 KiB
n,k = map(int, input().split()) coins = [] have = [] for i in range(n): a,b = map(int, input().split()) coins.append(a) have.append(b) ans = 0 sum = 0 for i in range(len(coins)-1): if have[i]==0 and sum + coins[i] < coins[i+1] and sum+coins[i] < k: ans += 1 sum += coins[i] if sum+coins[-1] < k: ans += 1 sum += coins[-1] print(ans) print(k-sum)
#Verdict Execution timeMemoryGrader output
Fetching results...