ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1380. Ostap's Chess

If WA#9
Posted by Timur Sitdikov (MSU Tashkent) 15 Jul 2011 10:26
Try this:

0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 6 0 0 0 0 0
0 0 0 0 0 0 0 0
-3 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1
White
c6-d7

Incorrect

0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 6 0 0 0 0 0
0 0 0 0 0 0 0 0
-3 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
Re: If WA#9
Posted by Jane Soboleva (SumNU) 11 Jan 2016 03:38
I had WA9 because i thought there would be only one king of the same color, but seems like actually there might be more. Thankfully to take more kings into account i had to delete some of my code rather than add some.

An example test:

0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 -1 0 0 0 0 0 0
6 0 6 0 0 0 0 0
1
White
<any move> (for example a1-a2 or c1-c2)

The answer is "Incorrect" and then a table, because no matter what white does, there's at least one king remaining under check.

Also had WA7 because of using shortint and a bit too small constant for amount of available moves. After changing from 100 to 300 and from shortint to longint got AC.

An example test, where white have 288 available moves:

5 5 5 5 5 5 5 5
5 0 0 0 0 0 0 5
5 0 0 0 0 0 0 5
5 0 0 0 0 0 0 5
5 0 0 0 0 0 0 5
5 0 0 0 0 0 0 5
5 0 0 0 0 0 0 5
5 5 5 5 5 5 5 5
1
White
a1-b2

Result: "Draw" and table output.

Edited by author 11.01.2016 03:55