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

View as PDF

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Consider the lattice points with x-coordinates between 0 and 2 and y-coordinates between 0 and . 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 points to form a polygon such that the polygon is simple and any two adjacent points in the polygon are neighbors.

#### Constraints

For at most 30% of marks, .

For at most 70% of marks, .

#### Input Specification

The first line will contain a single integer, .

#### Output Specification

Output the number of polygons mod .

#### Sample Input

3

#### Sample Output

8

#### Sample Input

4

#### Sample Output

40