Fishy business in KCHESS beginner problem

test
weak-test-case

#1

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…


#2

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.