Example Input 6 2 3 1 1 4 2 Output Yes Yes Yes No Yes No
- User
Example Input
6 2 3 1 1 4 2
Output
Yes Yes Yes No Yes No
Assistant
n = int(input()) numbers = [int(input()) for _ in range(n)] q = int(input()) queries = [int(input()) for _ in range(q)] possible_sums = {0} for num in numbers: new_sums = {s + num for s in possible_sums} possible_sums |= new_sums for target in queries: print("Yes" if target in possible_sums and target != 0 else "No")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.