Submit | All submissions | Best solutions | Back to list |
EIQUEENS - Eight queens puzzle |
The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal.
Input
Input will contain a description of a single chess board, given as eight lines of eight characters each. Input lines will consist of only the characters ‘.’ and ‘*’. The ‘.’ character represents an empty space on the board, and the ‘*’ character represents a queen.
Output
Print a single line of output. Print the word “valid” if the given chess board is a valid solution to the eight queens problem. Otherwise, print “invalid”.
Example
Input: *....... ..*..... ....*... ......*. .*...... .......* .....*.. ...*.... Output: invalid Input: *....... ......*. ....*... .......* .*...... ...*.... .....*.. ..*..... Output: valid
Added by: | Ha Minh Ngoc |
Date: | 2019-04-09 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |