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

Packing

Time limit: 1000 ms
Memory limit: 256 MB
Marisa got $n$ unused items, and she decided to put them in some boxes. The $i^{th}$ item weighs $w_i$. Knowing each box can withstand a weight of $W$, what's the minimum number of boxes does she need to use? ### Input - The first line contains 2 integers $n, W$. - The second line contains $n$ integers $w_i$. ### Output - Print the minimum number of boxes she need. ### Constraints - $1 \le n \le 20$. - $1 \le A_i \le W \le 10^9$. ### Example Input: ``` 4 5 1 2 3 4 ``` Output: ``` 2 ```
Bitmask DP
Binary board
Travelling Salesman Problem 2
Brewing potion 5
Subsequences counting
Wooden house
Xiangqi
Packing
Permutation counting
Counting tilings
Superstring
Custom keyboard
Mushroom harvesting III
Topic
Dynamic Programming
Bitmasks
Rating 1500
Solution (0) Solution