You are not logged in. Please login at www.codechef.com to post your questions!

×

Fishy business in KCHESS beginner problem

 0 I was looking through the beginner problems yesterday and I found an interesting problem, KCHESS. (I wrote a solution here.) It is solved by going through every single knight, and then checking if a knight can move to any of the 9 squares the king is in/can move to. But then I found someone had this extremely short solution in python (which I also rewrote in pascal). This solution just checks if the knight is on the same row/col. And it passes the test cases apparently. I found a test case such that the short solutions don't work, but the first one I did before works: 1 9 0 1 0 4 1 6 2 6 5 6 6 4 5 0 2 0 4 1 3 3  Where the expected output is: YES  Since all the squares are under check. The short solutions return NO but the longer ones return YES. Test cases probably should be fixed for this problem... asked 24 Dec '18, 03:46 0★ymir 1 accept rate: 0%

One Answer:
 0 There seems to problem in the test cases. I created a program that only checks if it is a "check" and not a checkmate. And I got an AC. So I guess the test cases are weak. answered 29 Dec '18, 15:40 2★joel1999 1 accept rate: 0%
 toggle preview community wiki:
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• link:[text](http://url.com/ "title")
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×197
×161

question asked: 24 Dec '18, 03:46

question was seen: 113 times

last updated: 29 Dec '18, 15:40