report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Minimum difference - FlandreOJ: Flandre Online Judge

Minimum difference

Time limit: 1000 ms
Memory limit: 256 MB
You are given an array $A$ of $n$ integers. Divide $A$ into 2 sets of numbers so that the absolute difference in their sum is as small as possible. ### Input - The first line contains an integer $n$. - The second line contains $n$ integers $A_i$. ### Output - Print the minimum difference. ### Constraints - $1 \le n \le 40$. - $-10^9 \le A_i \le 10^9$. ### Example Input: ``` 3 1 2 4 ``` Output: ``` 1 ```
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 900
Solution (0) Solution