Submission #726998

#TimeUsernameProblemLanguageResultExecution timeMemory
726998beaconmcCoins (BOI06_coins)Pypy 3
90 / 100
904 ms41244 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 and have[-1]==0: ans += 1 sum += coins[-1] print(ans) print((k-sum) if (k-sum) >= 1 else 1)
#Verdict Execution timeMemoryGrader output
Fetching results...