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

Robot

Time limit: 1500 ms
Memory limit: 256 MB
You have a robot located at point $(0, 0)$ on a 2D plane. The robot can run $n$ command. If the robot are now at $(x, y)$, and you execute the $i^{th}$ command, your robot will move to $(x + x_i, y + y_i)$. Each command can only be executed only once. Count the number of way to reach point $(a, b)$. ### Input - The first line contains an integer $n$. - The second line contains 2 integers $a, b$. - The next $n$ lines, each line contains 2 integers $x_i, y_i$. ### Output - Print the number of ways to reach point $(a, b)$. ### Constraints - $1 \le n \le 40$. - $-10^9 \le x_i, y_i, a, b \le 10^9$. ### Example Input: ``` 2 1 1 0 1 1 0 ``` 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 (1) Solution