# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
726995 | beaconmc | Coins (BOI06_coins) | Pypy 3 | 923 ms | 46820 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]
print(ans)
print(k-sum)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |