Files
problemas-para-competicao-p…/subset-sum/src/alternative-ac.py

15 lines
281 B
Python

n, t = map(int, input().split())
books = list(map(int, input().split()))
dp = [False] * (t + 1)
dp[0] = True
for book in books:
for i in range(t, book - 1, -1):
if dp[i - book]:
dp[i] = True
if dp[t]:
print("PERFEITO!")
else:
print("IMPOSSIVEL!")