# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
726996 | beaconmc | Coins (BOI06_coins) | Pypy 3 | 906 ms | 41380 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |