CF15E.Triangles
省选/NOI-
通过率:0%
时间限制:1.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but by a strange, in his opinion, pattern of the forest that has n levels, where n is an even number.
In the local council you were given an area map, where the granny's house is marked by point H, parts of dense forest are marked grey (see the picture to understand better).
After a long time at home Peter decided to yield to his granny's persuasions and step out for a breath of fresh air. Being prudent, Peter plans the route beforehand. The route, that Peter considers the most suitable, has the following characteristics:
- it starts and ends in the same place — the granny's house;
- the route goes along the forest paths only (these are the segments marked black in the picture);
- the route has positive length (to step out for a breath of fresh air Peter has to cover some distance anyway);
- the route cannot cross itself;
- there shouldn't be any part of dense forest within the part marked out by this route;
You should find the amount of such suitable oriented routes modulo 1000000009.

The example of the area map for n = 12 is given in the picture. Since the map has a regular structure, you can construct it for other n by analogy using the example.
去年夏天,彼得在乡下的奶奶家,附近森林中发生了一匹狼袭击羊群的事件。从此,他害怕穿过森林、绕过森林,甚至不敢走出家门。他将这种恐惧归因于森林一种奇特的结构(在他看来),该森林共有 n 层,其中 n 为偶数。
你在当地议会获得了一份该区域的地图,图中用点 H 标出了奶奶家的位置,而茂密森林区域则以灰色标出(参见图片以便更清晰地理解)。
在家待了很长时间后,彼得终于屈从于奶奶的劝说,决定出门呼吸一下新鲜空气。出于谨慎,彼得事先规划好了路线。他认为最合适的路线需满足以下条件:
- 路线起点与终点为同一位置——即奶奶家;
- 路线仅沿森林中的小径行进(这些小径在图中以黑色线段标出);
- 路线长度为正(为呼吸新鲜空气,彼得无论如何都必须走一段距离);
- 路线不能自相交叉;
- 该路线所围成的区域内不得包含任何茂密森林部分;
你需要计算满足上述条件的有向路线总数,并对 1000000009 取模。

图中给出了 n=12 时的区域地图示例。由于该地图具有规则结构,你可参照此例类比构造其他偶数 n 对应的地图。
输入格式
The input data contain the only even integer n (2 ≤ n ≤ 106).
输入数据包含唯一的偶整数 n(2 ≤ n ≤ 106)。
输出格式
Output the only number — the amount of Peter's routes modulo 1000000009.
输出唯一的数字——Peter 的路径数量对 1000000009 取模的结果。
输入输出样例
输入#1
2
输出#1
10
输入#2
4
输出#2
74
输入解题思路,AI测评打分。不知道怎么写?