report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Subset sum 2 - MarisaOJ: Marisa Online Judge

Subset sum 2

Time limit: 1500 ms
Memory limit: 256 MB
Given an array $A$ of $n$ integers, your task is to determine whether there exists a subset of $A$ whose sum is equal to $k$. ### Input - The first line contains two integers $n,k$. - The second line contains $n$ integers $A_i$. ### Output - Print YES if there exists a subset of $A$ whose sum is equal to $k$ otherwise, print `NO`. ### Constraints - $1 \le n \le 40$. - $1 \le A_i,k \le 10^{18}$. ### Example Input: ``` 4 7 1 2 3 4 ``` Output: ``` YES ```
Introduction to meet in the middle
Subset sum 2
Sum of four values
Robot
Minimum difference
Maximum sum subset
Stealing books
Topic
Meet in the middle
Rating 800
Solution (1) Solution