Codeforces 493D Vasya and Chess simple game

Source: Internet
Author: User


Vasya and ChessTime limit:2000MS Memory Limit:262144KB 64bit IO Format:%i64d &%i6 4u codeforces 493D


Description



Vasya decided to learn to play chess. Classic chess doesn ' t seem interesting to him, so he plays his own sort of chess.



The Queen is the piece so captures all squares in its vertical, horizontal and diagonal lines. If the cell is located on the same vertical, horizontal or diagonal line with queen, and the cell contains a piece of the Enemy color, the Queen is able to move to this square. After the enemy ' s piece are removed from the board. The Queen cannot move to a cell containing an enemy piece if there are some other piece between it and the Queen.



There is an n x n chessboard. We ' ll denote a cell on the intersection of the R-th row and C-th column as (R, C). The square (1, 1) contains the White Queen and the square (1, n) contains the black queen. All the other squares contain green pawns and that's don ' t belong to anyone.



The players move in turns. The player is moves first plays for the White Queen, and his opponent plays for the Black queen.



On each move the player have to capture some piece with he queen (that's, move to a square that contains either a green p Awn or the enemy queen). The player loses if either he cannot capture any piece during his move or the opponent took his queen during the previous Move.



Help Vasya determine who wins if both players play with a optimal strategy on the board n x n.



Input



The input contains a single number n (2≤ n ≤109)-the size of the board.



Output



On the first line print the answer to problem-string ' white' or string 'black ', depending on who wins if the bot H players play optimally.



If the answer is ' white', then you should also print and integers r and C representing the C Ell (R, C), where the first player should make he first move to win. If There is multiple such cells, print the one with the minimum R. If there is still multiple squares, print the one with the minimum c.



Sample Input


Input
2
Output
White
1 2
Input
3
Output
Black


Hint



In the first sample test the White queen can capture the black queen on the first move, so the "the white player wins."



The second test from the statement if the White queen captures the green pawn located on the central vertical Line, the n It'll be captured by the Black Queen during the next move. So the-only move for the white player was to capture the green pawn located at (2, 1).



Similarly, the Black queen doesn ' t has any other options but to capture the green pawn located at (2, 3), otherwise I F It goes to the middle vertical line, it'll be a captured by the White Queen.



During the next move the same thing happens-neither the white, nor the Black Queen have other options rather than to Capt Ure Green pawns situated above them. Thus, the White Queen ends up on square (3, 1), and the Black Queen ends up on square (3, 3).



In this situation the Queen have to capture all of the green pawns located on the middle vertical 'll is captured by the Black queen. Thus, the player plays for the Black queen wins.






Test instructions: The black and White Queen can walk sideways on the board and walk diagonally, assuming that there's a piece for you to eat. You can't cross a piece to eat another piece.



In addition to the black and White Queen, all the other places are covered with neutral units. Go ahead and ask who's going to win the White win, give me the first step.






For the first time, because it's symmetrical, so the water is on the draft, and the N is on the 4, and the conclusion is almost there.



It's my understanding that white and black have to be in the middle first, and whoever has to go down first will lose.





#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define FIN     freopen("input.txt","r",stdin);
#define FOUT    freopen("output.txt","w",stdout);
#define INF     0x3f3f3f3f
#define lson    l,m,rt<<1
#define rson    m+1,r,rt<<1|1
typedef long long LL;

int main()
{
    int n;
    cin>>n;
    if(n%2!=0)  printf("black\n");
    else  printf("white\n1 2\n");
    return 0;
}





Codeforces 493D Vasya and Chess simple game


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.