fork download
  1.  
  2.  
  3. no_test_cases = int(input())
  4. for _ in range(no_test_cases):
  5. result = []
  6. no_people, units_money = map(int, input().split())
  7. money_to_be_withdrawn = list(map(int, input().split()))
  8. for i in money_to_be_withdrawn:
  9. if units_money >= i:
  10. result.append(1)
  11. units_money -= i
  12. else:
  13. result.append(0)
  14. for i in result:
  15. print(i, end='')
Success #stdin #stdout 0.02s 9168KB
stdin
2
5 10
3 5 3 2 1
4 6
10 8 6 4
stdout
110100010