codeforces-scrape

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

825B.md (1508B)


      1 Source: https://codeforces.com/problemset/problem/825/B
      2 
      3 B. Five-In-a-Row
      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 Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.
     22 
     23 In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins immediately.
     24 
     25 Alice wins if some crosses in the field form line of length not smaller than 5. This line can be horizontal, vertical and diagonal.
     26 
     27 Input
     28 
     29 You are given matrix 10 × 10 (10 lines of 10 characters each) with capital Latin letters 'X' being a cross, letters 'O' being a nought and '.' being an empty cell. The number of 'X' cells is equal to the number of 'O' cells and there is at least one of each type. There is at least one empty cell.
     30 
     31 It is guaranteed that in the current arrangement nobody has still won.
     32 
     33 Output
     34 
     35 Print 'YES' if it's possible for Alice to win in one turn by putting cross in some empty cell. Otherwise print 'NO'.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 XX.XX.....  
     43 .....OOOO.  
     44 ..........  
     45 ..........  
     46 ..........  
     47 ..........  
     48 ..........  
     49 ..........  
     50 ..........  
     51 ..........
     52 ```
     53 
     54 Output
     55 
     56 ```
     57 YES
     58 ```
     59 
     60 Input
     61 
     62 ```
     63 XXOXX.....  
     64 OO.O......  
     65 ..........  
     66 ..........  
     67 ..........  
     68 ..........  
     69 ..........  
     70 ..........  
     71 ..........  
     72 ..........
     73 ```
     74 
     75 Output
     76 
     77 ```
     78 NO
     79 ```