codeforces-scrape

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

85A.md (1782B)


      1 Source: https://codeforces.com/problemset/problem/85/A
      2 
      3 A. Domino
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 We all know the problem about the number of ways one can tile a 2 × *n* field by 1 × 2 dominoes. You probably remember that it goes down to Fibonacci numbers. We will talk about some other problem below, there you also are going to deal with tiling a rectangular field with dominoes.
     22 
     23 You are given a 4 × *n* rectangular field, that is the field that contains four lines and *n* columns. You have to find for it any tiling by 1 × 2 dominoes such that each of the *n* - 1 potential vertical cuts along the grid lines intersects at least one domino, splitting it in two. No two dominoes in the sought tiling should overlap, each square of the field should be covered by exactly one domino. It is allowed to rotate the dominoes, that is, you can use 2 × 1 as well as 1 × 2 dominoes.
     24 
     25 Write a program that finds an arbitrary sought tiling.
     26 
     27 Input
     28 
     29 The input contains one positive integer *n* (1 ≤ *n* ≤ 100) — the number of the field's columns.
     30 
     31 Output
     32 
     33 If there's no solution, print "-1" (without the quotes). Otherwise, print four lines containing *n* characters each — that's the description of tiling, where each vertical cut intersects at least one domino. You should print the tiling, having painted the field in no more than 26 colors. Each domino should be painted a color. Different dominoes can be painted the same color, but dominoes of the same color should not be side-neighbouring. To indicate colors you should use lowercase Latin letters. Print any of the acceptable ways of tiling.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 4
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 yyzz  
     47 bccd  
     48 bxxd  
     49 yyaa
     50 ```