시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 218 61 57 30.978%

문제

체스에서 여왕은 강력한 말이다. 여왕은 가로, 세로, 그리고 대각선으로 제한없이 이동하여 상대를 공격할 수 있다.

사이나쁜 여왕 퀴즈는 여덟 여왕을 8x8 체스판 위에 배치하는데, 아무도 서로 공격할 수 없도록 배치하는 퀴즈다. 가운데 그림은 올바르지 않은 풀이인데, 두 여왕이 대각선을 통해서 서로 공격할 수 있기 때문이다. 오른쪽 그림은 올바른 해법이다. 우리는 체스판과 여왕의 배치가 주어질 때 해당 배치가 올바른 사이나쁜 여왕 퀴즈의 해법인지 아닌지를 판단해야 한다.

입력

입력은 하나의 체스판을 8줄에 걸쳐 줄마다 8개의 문자로 나타낸다.

각 문자는 '.' 혹은 '*' 이며 '.'은 빈 칸을, '*'은 여왕이 있음을 나타낸다.

출력

한 줄에 걸쳐 올바른 해법일 경우 "valid", 올바르지 않은 해법일 경우 "invalid"를 출력한다.

예제 입력 1

*.......
..*.....
....*...
......*.
.*......
.......*
.....*..
...*....

예제 출력 1

invalid

예제 입력 2

*.......
......*.
....*...
.......*
.*......
...*....
.....*..
..*.....

예제 출력 2

valid
W3sicHJvYmxlbV9pZCI6IjEwNDY5IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVjMGFjXHVjNzc0IFx1YjA5OFx1YzA1YyBcdWM1ZWNcdWM2NTVcdWI0ZTQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1Y2NiNFx1YzJhNFx1YzVkMFx1YzExYyBcdWM1ZWNcdWM2NTVcdWM3NDAgXHVhYzE1XHViODI1XHVkNTVjIFx1YjlkMFx1Yzc3NFx1YjJlNC4gXHVjNWVjXHVjNjU1XHVjNzQwIFx1YWMwMFx1Yjg1YywgXHVjMTM4XHViODVjLCBcdWFkZjhcdWI5YWNcdWFjZTAgXHViMzAwXHVhYzAxXHVjMTIwXHVjNzNjXHViODVjIFx1YzgxY1x1ZDU1Y1x1YzV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hhcmFjdGVyIHJlcHJlc2VudHMgYSBxdWVlbi48XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5QcmludCBhIHNpbmdsZSBsaW5lIG9mIG91dHB1dC4gUHJpbnQgdGhlIHdvcmQgJmxkcXVvO3ZhbGlkJnJkcXVvOyBpZiB0aGUgZ2l2ZW4gY2hlc3MgYm9hcmQgaXMgYSB2YWxpZCBzb2x1dGlvbiB0byB0aGUgZWlnaHQgcXVlZW5zIHByb2JsZW0uIE90aGVyd2lzZSwgcHJpbnQgJmxkcXVvO2ludmFsaWQmcmRxdW87LjxcL3A+XHJcbiIsImhpbnQiOiIiLCJvcmlnaW5hbCI6IjEiLCJwcm9ibGVtX2xhbmdfY29kZSI6Ilx1YzYwMVx1YzViNCJ9XQ==

출처

ACM-ICPC > Regionals > North America > North America Qualification Contest > ACM-ICPC North America Qualifier 2014 A번

  • 문제의 오타를 찾은 사람: jwvg0425
  • 어색한 표현을 찾은 사람: sgchoi5
  • 문제를 번역한 사람: tae