Submission #726995

# Submission time Handle Problem Language Result Execution time Memory
726995 2023-04-19T19:16:32 Z beaconmc Coins (BOI06_coins) PyPy 3
70 / 100
923 ms 46820 KB
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
1 Correct 40 ms 18220 KB Output is correct
2 Incorrect 39 ms 18120 KB Output isn't correct
3 Correct 45 ms 18168 KB Output is correct
4 Correct 36 ms 18188 KB Output is correct
5 Correct 43 ms 18200 KB Output is correct
6 Correct 36 ms 18228 KB Output is correct
7 Incorrect 923 ms 46584 KB Output isn't correct
8 Incorrect 835 ms 46276 KB Output isn't correct
9 Correct 897 ms 45860 KB Output is correct
10 Correct 847 ms 46820 KB Output is correct