codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1594E1.md (2199B)


      1 Source: https://codeforces.com/problemset/problem/1594/E1
      2 
      3 E1. Rubik's Cube Coloring (easy version)
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 It is the easy version of the problem. The difference is that in this version, there are no nodes with already chosen colors.
     22 
     23 Theofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should first finish his homework. Can you help him with this problem?
     24 
     25 You have a perfect binary tree of $2^k - 1$ nodes — a binary tree where all vertices $i$ from $1$ to $2^{k - 1} - 1$ have exactly two children: vertices $2i$ and $2i + 1$. Vertices from $2^{k - 1}$ to $2^k - 1$ don't have any children. You want to color its vertices with the $6$ Rubik's cube colors (White, Green, Red, Blue, Orange and Yellow).
     26 
     27 Let's call a coloring good when all edges connect nodes with colors that are neighboring sides in the Rubik's cube.
     28 
     29 |  |  |
     30 | --- | --- |
     31 |  |  |
     32 
     33 A picture of Rubik's cube and its 2D map. 
     34 
     35 More formally:
     36 
     37 * a white node can not be neighboring with white and yellow nodes;
     38 * a yellow node can not be neighboring with white and yellow nodes;
     39 * a green node can not be neighboring with green and blue nodes;
     40 * a blue node can not be neighboring with green and blue nodes;
     41 * a red node can not be neighboring with red and orange nodes;
     42 * an orange node can not be neighboring with red and orange nodes;
     43 
     44 You want to calculate the number of the good colorings of the binary tree. Two colorings are considered different if at least one node is colored with a different color.
     45 
     46 The answer may be too large, so output the answer modulo $10^9+7$.
     47 
     48 Input
     49 
     50 The first and only line contains the integers $k$ ($1 \le k \le 60$) — the number of levels in the perfect binary tree you need to color.
     51 
     52 Output
     53 
     54 Print one integer — the number of the different colorings modulo $10^9+7$.
     55 
     56 Examples
     57 
     58 Input
     59 
     60 ```
     61 3
     62 ```
     63 
     64 Output
     65 
     66 ```
     67 24576
     68 ```
     69 
     70 Input
     71 
     72 ```
     73 14
     74 ```
     75 
     76 Output
     77 
     78 ```
     79 934234
     80 ```
     81 
     82 Note
     83 
     84 In the picture below, you can see one of the correct colorings of the first example.
     85 
     86  ![](https://espresso.codeforces.com/a24bc78cbb7936f786c506b4e5e7f7c2a36d25cf.png)