codeforces-scrape

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

926D.md (2578B)


      1 Source: https://codeforces.com/problemset/problem/926/D
      2 
      3 D. Choose Place
      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 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 A classroom in a school has six rows with 3 desks in each row. Two people can use the same desk: one sitting on the left and one sitting on the right.
     22 
     23 Some places are already occupied, and some places are vacant. Petya has just entered the class and wants to occupy the most convenient place. The conveniences of the places are shown on the picture:
     24 
     25  ![](https://espresso.codeforces.com/957886e16d193f6ea2a9cde2366c8671fcffebdd.png) 
     26 
     27 Here, the desks in the top row are the closest to the blackboard, while the desks in the bottom row are the furthest from the blackboard.
     28 
     29 You are given a plan of the class, where '*' denotes an occupied place, '.' denotes a vacant place, and the aisles are denoted by '-'.
     30 
     31 Find any of the most convenient vacant places for Petya.
     32 
     33 Input
     34 
     35 The input consists of 6 lines. Each line describes one row of desks, starting from the closest to the blackboard. Each line is given in the following format: two characters, each is '*' or '.' — the description of the left desk in the current row; a character '-' — the aisle; two characters, each is '*' or '.' — the description of the center desk in the current row; a character '-' — the aisle; two characters, each is '*' or '.' — the description of the right desk in the current row. So, the length of each of the six lines is 8.
     36 
     37 It is guaranteed that there is at least one vacant place in the classroom.
     38 
     39 Output
     40 
     41 Print the plan of the classroom after Petya takes one of the most convenient for him places. Mark this place with the letter 'P'. There should be exactly one letter 'P' in the plan. Petya can only take a vacant place. In all other places the output should coincide with the input.
     42 
     43 If there are multiple answers, print any.
     44 
     45 Examples
     46 
     47 Input
     48 
     49 ```
     50 ..-**-..  
     51 ..-**-..  
     52 ..-..-..  
     53 ..-..-..  
     54 ..-..-..  
     55 ..-..-..
     56 ```
     57 
     58 Output
     59 
     60 ```
     61 ..-**-..  
     62 ..-**-..  
     63 ..-..-..  
     64 ..-P.-..  
     65 ..-..-..  
     66 ..-..-..
     67 ```
     68 
     69 Input
     70 
     71 ```
     72 **-**-**  
     73 **-**-**  
     74 ..-**-.*  
     75 **-**-**  
     76 ..-..-..  
     77 ..-**-..
     78 ```
     79 
     80 Output
     81 
     82 ```
     83 **-**-**  
     84 **-**-**  
     85 ..-**-.*  
     86 **-**-**  
     87 ..-P.-..  
     88 ..-**-..
     89 ```
     90 
     91 Input
     92 
     93 ```
     94 **-**-*.  
     95 *.-*.-**  
     96 **-**-**  
     97 **-**-**  
     98 ..-..-..  
     99 ..-**-..
    100 ```
    101 
    102 Output
    103 
    104 ```
    105 **-**-*.  
    106 *.-*P-**  
    107 **-**-**  
    108 **-**-**  
    109 ..-..-..  
    110 ..-**-..
    111 ```
    112 
    113 Note
    114 
    115 In the first example the maximum convenience is 3.
    116 
    117 In the second example the maximum convenience is 2.
    118 
    119 In the third example the maximum convenience is 4.