Tap here to switch tabs
Problem
Submissions

Problem: Count Collisions of Monkeys on a Polygon

med
30 min
Try to solve the Count Collisions of Monkeys on a Polygon problem.

Statement

There is a regular convex polygon with n vertices. Each vertex is occupied by exactly 11 monkey. The vertices are numbered from 00 to n −1- 1 in clockwise order.

Every monkey chooses to move to an adjacent vertex simultaneously. Each monkey independently chooses to move either in a clockwise direction or in a counterclockwise direction.

A collision takes place if at least 22 monkeys cross each other while moving along an edge or end up at the same vertex.

Return the number of movement configurations in which at least 11 collision occurs. Since the answer can be very large, return it modulo 109+710^9 + 7.

Note: Each monkey moves at the same speed and only moves once.

Constraints:

  • 3≤3 \leq n ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Collisions of Monkeys on a Polygon

med
30 min
Try to solve the Count Collisions of Monkeys on a Polygon problem.

Statement

There is a regular convex polygon with n vertices. Each vertex is occupied by exactly 11 monkey. The vertices are numbered from 00 to n −1- 1 in clockwise order.

Every monkey chooses to move to an adjacent vertex simultaneously. Each monkey independently chooses to move either in a clockwise direction or in a counterclockwise direction.

A collision takes place if at least 22 monkeys cross each other while moving along an edge or end up at the same vertex.

Return the number of movement configurations in which at least 11 collision occurs. Since the answer can be very large, return it modulo 109+710^9 + 7.

Note: Each monkey moves at the same speed and only moves once.

Constraints:

  • 3≤3 \leq n ≤109\leq 10^9