Mock CCO '18 Contest 1 Problem 5 - A Counting Problem

View as PDF

Submit solution

Points: 20 (partial)
Time limit: 0.18s
Memory limit: 16M

Problem type

Consider the 3N lattice points with x-coordinates between 0 and 2 and y-coordinates between 0 and N1. Define two points to be neighbors if their x-coordinates differ by at most 1 and their y-coordinates differ by at most 1. Compute the number of ways to connect all 3N points to form a polygon such that the polygon is simple and any two adjacent points in the polygon are neighbors.

Constraints

1N109

Subtask 1 [30%]

N200

Subtask 2 [40%]

N105

Subtask 3 [30%]

No additional constraints.

Input Specification

The first line will contain a single integer, N.

Output Specification

Output the number of polygons mod 109.

Sample Input 1

Copy
3

Sample Output 1

Copy
8

Sample Input 2

Copy
4

Sample Output 2

Copy
40

Comments

There are no comments at the moment.