If you decide not to repeat my mistake, then the 49th check is that the king must bypass the black pawn in order to catch up with the white one, I will not talk further, but just give you an example: 8 a3 d7 e6 Answer:BLACK WINS 8 a2 b3 h1 WHITE WINS 8 a2 b3 g2 BLACK WINS 8 d6 e7 e6 BLACK WINS (if you use DP as me, the following tests are useful) 8 a6 h2 g2 WHITE WINS 8 a2 b3 g3 BLACK WINS 8 a2 b4 h1 BLACK WINS 8 a2 b3 h1 WHITE WINS The problem is really good. It makes me more considerate and ..trains my patience... I submited many time but all -> wr on test 59. could anyone help me ?? this test helped me: 8 b2 c4 h1 Dear Admins, don't you think that it would be prudent to state(or at least give a little hint), that WHITE IS TO MOVE FIRST?!!! Or is it so self-evident?! Thank you. My prog passes all 307 tests from the forum and gets WA6, help me please... ) I had the same problem. I was inputting data as follows. char x, y; cin>>x>>y; WhitePawn.x = x-'a'+1; WhitePawn.y = y-'0'; What I should have done was char x; int y; cin>>x>>y; WhitePawn.x = x-'a'+1; WhitePawn.y = y; Got the point? That's why your prog passes all f*illion tests on this forum- they all have n=8. GoodLuck! i think it's much easier and faster. Yes, I did the same thing. In this case it is much simpler not to forget something... i changed my algorithm from checking cases to searching with memorizing, but always get wa on test 7. after one day's struggle, i'm nearly crazy... at last i found my reading part has a mistake that i read the data like this: scanf("%s", tmp); p[0] = tmp[0] - 'a'; p[1] = tmp[1] - '1'; but when N is greater than 9, p[1] may have 2 digits...... i hope no one will make SUCH a SILLY mistake like me, especially spending one day on it... Edited by author 12.09.2007 08:15 что делать если черная пешка окажется на 1 горизонтали? 8 a1 a5 h1 8 a2 a7 h1 8 b4 a7 h1 8 b2 c4 h1 8 c5 c4 h1 8 d6 d7 h1 8 d5 c6 h1 8 d5 h7 h1 8 d7 h7 d8 8 a7 h7 a8 8 d4 h7 b4 8 d4 h7 b3 8 d4 h7 d3 8 d2 h7 c2 8 d2 h7 d3 8 d3 h7 h3 8 d4 h7 h3 8 d4 h7 h4 8 d4 h7 h8 8 d4 h7 a8 8 d6 h7 f8 8 d5 h7 f7 8 d5 h7 b7 8 a5 h2 a1 8 a5 g2 a1 8 a5 f2 a1 8 a5 h2 e4 8 a5 g2 e3 8 a5 h2 h1 8 a4 h2 h1 8 a4 g2 g1 8 a5 g2 g1 8 a5 g2 d5 8 h5 a2 a5 8 h5 a2 a1 8 h5 a2 b2 8 h5 b2 a5 8 h5 b2 b1 8 h5 b2 e4 8 h5 h2 a5 8 h5 h3 a5 8 c5 c2 c1 8 c4 c2 c1 8 d2 c2 c1 8 d3 c3 c2 8 d4 c4 c3 8 d4 c2 c1 8 e4 e2 h1 8 e5 e2 h1 8 e6 d6 c6 8 e5 d5 c5 8 e5 d6 c6 8 e4 d5 c5 8 d4 a7 f4 8 d4 e5 f4 8 a3 h7 e3 8 a3 d4 e3 8 a5 b6 d6 8 a5 h6 d6 BLACK WINS BLACK WINS BLACK WINS BLACK WINS WHITE WINS BLACK WINS WHITE WINS WHITE WINS BLACK WINS BLACK WINS BLACK WINS WHITE WINS WHITE WINS WHITE WINS BLACK WINS BLACK WINS WHITE WINS WHITE WINS WHITE WINS BLACK WINS WHITE WINS BLACK WINS BLACK WINS BLACK WINS BLACK WINS WHITE WINS WHITE WINS WHITE WINS WHITE WINS BLACK WINS BLACK WINS WHITE WINS BLACK WINS BLACK WINS WHITE WINS WHITE WINS BLACK WINS WHITE WINS WHITE WINS BLACK WINS WHITE WINS WHITE WINS BLACK WINS BLACK WINS WHITE WINS WHITE WINS WHITE WINS BLACK WINS BLACK WINS WHITE WINS BLACK WINS WHITE WINS BLACK WINS BLACK WINS BLACK WINS BLACK WINS WHITE WINS WHITE WINS WHITE WINS
thnx 4 good test collection. My program done it right, but i can't done f-n' 49 test I not understand Why i got WA #24? !!!! help me !!!! Now I got WA #48! help plz! my program get correct answers for all tests in forum!! Who help me? Try these tests: 232 8 a1 a5 h1 BLACK WINS 8 a2 a7 h1 BLACK WINS 8 b4 a7 h1 BLACK WINS 8 b2 c4 h1 BLACK WINS 8 c5 c4 h1 WHITE WINS 8 d6 d7 h1 BLACK WINS 8 d5 c6 h1 WHITE WINS 8 d5 h7 h1 WHITE WINS 8 d7 h7 d8 BLACK WINS 8 a7 h7 a8 BLACK WINS 8 d4 h7 b4 BLACK WINS 8 d4 h7 b3 WHITE WINS 8 d4 h7 d3 WHITE WINS 8 d2 h7 c2 WHITE WINS 8 d2 h7 d3 BLACK WINS 8 d3 h7 h3 BLACK WINS 8 d4 h7 h3 WHITE WINS 8 d4 h7 h4 WHITE WINS 8 d4 h7 h8 WHITE WINS 8 d4 h7 a8 BLACK WINS 8 d6 h7 f8 WHITE WINS 8 d5 h7 f7 BLACK WINS 8 d5 h7 b7 BLACK WINS 8 a5 h2 a1 BLACK WINS 8 a5 g2 a1 BLACK WINS 8 a5 f2 a1 WHITE WINS 8 a5 h2 e4 WHITE WINS 8 a5 g2 e3 WHITE WINS 8 a5 h2 h1 WHITE WINS 8 a4 h2 h1 BLACK WINS 8 a4 g2 g1 BLACK WINS 8 a5 g2 g1 WHITE WINS 8 a5 g2 d5 BLACK WINS 8 h5 a2 a5 BLACK WINS 8 h5 a2 a1 WHITE WINS 8 h5 a2 b2 WHITE WINS 8 h5 b2 a5 BLACK WINS 8 h5 b2 b1 WHITE WINS 8 h5 b2 e4 WHITE WINS 8 h5 h2 a5 BLACK WINS 8 h5 h3 a5 WHITE WINS 8 c5 c2 c1 WHITE WINS 8 c4 c2 c1 BLACK WINS 8 d2 c2 c1 BLACK WINS 8 d3 c3 c2 WHITE WINS 8 d4 c4 c3 WHITE WINS 8 d4 c2 c1 WHITE WINS 8 e4 e2 h1 BLACK WINS 8 e5 e2 h1 BLACK WINS 8 e6 d6 c6 WHITE WINS 8 e5 d5 c5 BLACK WINS 8 e5 d6 c6 WHITE WINS 8 e4 d5 c5 BLACK WINS 8 d4 a7 f4 BLACK WINS 8 d4 e5 f4 BLACK WINS 8 a3 h7 e3 BLACK WINS 8 a3 d4 e3 WHITE WINS 8 a5 b6 d6 WHITE WINS 8 a5 h6 d6 WHITE WINS 8 a2 a7 h1 BLACK WINS 8 a6 a5 h1 WHITE WINS 8 a3 b6 h1 BLACK WINS 8 a6 b6 h1 WHITE WINS 8 d5 c6 f5 WHITE WINS 8 d5 c6 a5 WHITE WINS 8 b4 d5 e4 WHITE WINS 8 b3 h7 f3 BLACK WINS 8 b2 h7 g2 WHITE WINS 8 b4 b3 h2 BLACK WINS 8 b5 b3 h2 WHITE WINS 8 b5 b2 b3 WHITE WINS 8 a4 g3 h8 BLACK WINS 8 a4 g3 g2 WHITE WINS 8 a4 h3 h8 BLACK WINS 8 a4 h3 g2 WHITE WINS 8 d3 g4 h3 WHITE WINS 8 d3 f5 h3 WHITE WINS 8 d3 e6 h3 BLACK WINS 8 d3 g3 h3 BLACK WINS 8 d2 g4 h3 WHITE WINS 8 d2 g3 h3 BLACK WINS 8 d2 f5 h3 WHITE WINS 8 d2 f3 f1 WHITE WINS 8 d2 f2 f1 BLACK WINS 8 a2 h3 h1 BLACK WINS 8 a2 h4 h1 WHITE WINS 8 a2 h4 g1 BLACK WINS 8 a2 h4 g2 WHITE WINS 8 a2 h3 g2 BLACK WINS 8 a2 g3 g2 BLACK WINS 8 a2 g4 g2 WHITE WINS 8 a2 g4 g1 WHITE WINS 8 a2 g4 f1 BLACK WINS 8 a2 b4 h1 BLACK WINS 8 d6 c7 e6 WHITE WINS 8 d6 d7 e6 BLACK WINS 8 d6 e7 e6 BLACK WINS 8 a2 c5 a1 WHITE WINS 8 a2 c4 a1 WHITE WINS 8 a2 g4 a1 BLACK WINS 8 a2 h7 a3 BLACK WINS 8 a2 d4 c3 BLACK WINS 8 b2 c3 h1 WHITE WINS 8 b2 c3 h2 BLACK WINS 8 b2 c3 h2 BLACK WINS 8 b2 c3 c2 WHITE WINS 8 b2 c3 a2 BLACK WINS 8 b2 c2 c1 BLACK WINS 8 b6 b2 c1 WHITE WINS 8 b5 b2 c1 BLACK WINS 8 b5 b2 b1 WHITE WINS 8 b5 b2 b3 WHITE WINS 8 a2 b3 b2 WHITE WINS 8 a3 b4 b3 BLACK WINS 8 a3 b4 b2 WHITE WINS 8 b5 c6 d6 WHITE WINS 8 a4 b5 c4 BLACK WINS 8 a3 b4 c3 BLACK WINS 8 a5 b6 c5 WHITE WINS 8 a2 h5 h8 WHITE WINS 8 a2 h4 h8 BLACK WINS 8 a2 h5 h1 WHITE WINS 8 a2 h5 h2 WHITE WINS 8 a2 h3 h2 BLACK WINS 8 a2 h4 h1 WHITE WINS 8 a2 e3 f2 BLACK WINS 8 a2 d4 e3 WHITE WINS 8 a2 e4 e3 BLACK WINS 8 b4 c5 d5 BLACK WINS 8 b5 c6 d6 WHITE WINS 8 b2 c3 d3 BLACK WINS 8 b2 c3 d2 BLACK WINS 8 b4 h3 h8 BLACK WINS 8 b5 h3 h8 WHITE WINS 8 b4 h4 h8 WHITE WINS 8 b4 h3 h1 WHITE WINS 8 b3 h3 h1 BLACK WINS 8 b2 h3 h1 BLACK WINS 8 a5 a2 h1 BLACK WINS 8 a6 a2 h1 WHITE WINS 8 a5 a2 a1 WHITE WINS 8 a5 a2 a3 WHITE WINS 8 a5 g2 h1 BLACK WINS 8 a5 g2 g1 WHITE WINS 8 a4 g2 h1 BLACK WINS 8 a5 g2 h1 BLACK WINS 8 b5 g2 g1 WHITE WINS 8 b5 g2 f2 WHITE WINS 8 b5 g2 e3 WHITE WINS 8 g5 g2 h1 BLACK WINS 8 g5 g2 g1 WHITE WINS 8 g5 g2 g3 WHITE WINS 8 h5 g2 g3 WHITE WINS 8 h5 g2 g5 BLACK WINS 8 h5 a2 a3 BLACK WINS 8 h5 a2 b2 WHITE WINS 8 h5 a2 c3 WHITE WINS 8 h6 a2 b1 WHITE WINS 8 g5 a2 a3 BLACK WINS 8 g6 a2 a3 WHITE WINS 8 g5 a2 b2 WHITE WINS 8 g4 a2 b2 BLACK WINS 8 a5 a2 b2 BLACK WINS 8 a6 a2 b2 WHITE WINS 8 a5 a2 a1 WHITE WINS 8 a5 a2 a3 WHITE WINS 8 a8 a2 b2 WHITE WINS 8 b5 a2 b2 WHITE WINS 8 b5 a2 a3 WHITE WINS 8 b4 a2 a3 BLACK WINS 8 b4 a2 b1 BLACK WINS 8 b4 a2 b2 BLACK WINS 8 b4 a2 b3 BLACK WINS 8 b5 a2 b2 WHITE WINS 8 b5 a2 b1 WHITE WINS 8 g5 a2 b1 BLACK WINS 8 g6 a2 b1 WHITE WINS 8 g5 a2 b2 WHITE WINS 8 d5 a7 a8 WHITE WINS 8 d5 a7 b8 BLACK WINS 8 d5 a7 a5 WHITE WINS 8 d3 a3 a2 WHITE WINS 8 d3 a3 d2 BLACK WINS 8 d2 c3 a1 WHITE WINS 8 d2 c3 c2 WHITE WINS 8 d2 c3 b2 BLACK WINS 8 a6 a7 a8 BLACK WINS 8 g4 e7 d7 BLACK WINS 8 g5 e7 d7 WHITE WINS 8 g6 h7 h8 BLACK WINS 8 g6 h7 f8 WHITE WINS 8 g6 h7 g8 BLACK WINS 8 g6 h7 g7 BLACK WINS 8 d6 e7 d7 BLACK WINS 8 d6 e7 e8 BLACK WINS 8 d6 e7 b8 WHITE WINS 8 d6 e7 f8 WHITE WINS 8 d6 e7 f7 WHITE WINS 8 d6 e7 g8 WHITE WINS 8 d6 e6 f7 WHITE WINS 8 d5 e6 f7 BLACK WINS 8 d5 e6 f6 WHITE WINS 8 d5 e6 b6 WHITE WINS 8 d5 e6 c7 BLACK WINS 8 b4 c5 a4 BLACK WINS 8 b4 c5 e5 BLACK WINS 8 b4 c5 f5 WHITE WINS 8 b6 c7 a6 WHITE WINS 8 b6 c7 b7 BLACK WINS 8 b6 c7 c6 BLACK WINS 8 c5 d6 e6 WHITE WINS 8 a7 b7 a8 BLACK WINS 8 a7 b7 c7 WHITE WINS 8 a6 b7 c7 WHITE WINS 8 a6 b7 b8 BLACK WINS 8 a6 b7 b6 BLACK WINS 8 a5 b6 c6 WHITE WINS 8 a4 b5 c5 BLACK WINS 8 b5 c6 d6 WHITE WINS 8 a6 a7 a8 BLACK WINS 8 b6 c7 a8 WHITE WINS 8 b6 c7 b8 BLACK WINS 8 a2 b2 b1 BLACK WINS 8 a4 b2 b1 WHITE WINS 8 a4 g2 g1 BLACK WINS 8 a4 h2 h1 BLACK WINS 8 d6 c7 e6 WHITE WINS 8 d6 c7 b7 WHITE WINS 8 d6 c7 c8 BLACK WINS 8 a3 b4 b3 BLACK WINS 8 a3 b4 b2 WHITE WINS 8 c3 d4 b3 BLACK WINS I check all this tests, but still get WA2 and WA6. May be, here another interesting cases? Thanks. but I foget numbers!! sorry! after redjude i got WA82! I fixe Wa82 but now next test Wa83. now Wa83. I very Happy!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! You are happy for me? This is too many test. So i write a simply testing program. You should create 4 files: /* --------------- testgen.c -----------------*/ #include <stdio.h> #include <process.h> #include <string.h> char S[ 123 ], A[ 123 ]; int main() { int i; freopen( "tests.txt", "rt", stdin ); for( i = 1; scanf( "%[^\n]%*c", S ) != EOF; i++ ) { sprintf( A, "1216in.%d", i ); freopen( A, "wt", stdout ); printf( "%s\n", S ); scanf( "%[^\n]%*c", S ); printf( "%s\n", S ); fclose( stdout ); sprintf( A, "1216ans.%d", i ); freopen( A, "wt", stdout ); scanf( "%[^\n]%*c", S ); printf( "%s\n", S ); fclose( stdout ); } fclose( stdin ); return 0; } /* ---------------- tester.c -------------------*/ #include <stdio.h> #include <stdlib.h> char S[ 123 ], A[ 123 ]; int main( int count, char *arg[] ) { int i, j; j = atoi( arg[ 1 ] ); freopen( "1216test.bat", "wt", stdout ); for( i = 1; i <= j; i++ ) { printf( "call 1216.bat %d\n", i ); } fclose( stdout ); return 0; } /* -------------------- checker.c ---------------- */ #include <stdio.h> #include <string.h> char Ans[ 123 ], Out[ 123 ]; int main( int count, char *arg[] ) { FILE *fans = fopen( arg[ 1 ], "rt" ); FILE *fout = fopen( arg[ 2 ], "rt" ); fscanf( fans, "%[^\n]", Ans ); fscanf( fout, "%[^\n]", Out ); if( strcmp( Ans, Out ) == 0 ) printf( "%s: Ok\n", arg[ 3 ] ); else printf( "%s: Wrong answer\n", arg[ 3 ] ); fclose( fans ); fclose( fout ); return 0; } /* -------------- 1216.bat ----------------- */ 1216.exe <1216in.%1 >1216out.%1 checker.exe 1216ans.%1 1216out.%1 %1 Copy all tests to tests.txt without count (number 232). Then compile testgen.c and execute. It delimit this test to separated files. Then compile tester.c and execute with count by parameter. It generate 1216test.bat. Then execute 1216test.bat and enjoy. ::) Be sure what you 1216.exe is in the same directory. Edited by author 14.10.2005 18:24 Thanks for the help! I get(or got) AC. Edited by author 27.07.2005 14:09 It is nothing said about the following situation: 6 a2 a3 f1 I.e., whether a white pawn can jump over a black pawn from 2nd row on the 4th. Nothing is said in the problem statement, but a program which would output "WHITE WINS" for this test case gets WA on test 3. Please complete the problem description with this remark (or excuse me, if I didn't notice how to conclude an unambiguous rule for this case) And I also sent a test to yakovlev@metronome.ru, which possibly should be added to the test set, because my 2 programs, outputing different answers for this test case, both get AC. Some tests are wrong: Test 59: Input: 8 c2 b4 a1 Output ( jury ): BLACK WINS // it isn't true Output ( my ): WHITE WINS // it is true See chessboard: ...... ...... .B.... ...... ..W... K..... White pawn can jump from c2 to c4. Black pawn can't block it. Then WHITE player WINs the game. Edited by author 27.10.2004 00:23 Edited by author 27.10.2004 00:24 "Just after the white pawn makes a move from x2 to x4, the black pawn may beat the white pawn en passant, moving from y4 to x3, if y is a vertical line, neighboring to the x-vertical." I've got AC many weeks ago but a lot of people cann't do it. The task is not so hard as one may think, but it needs this: 1) Before coding you must find out all the tricks on paper (and there are a lot of tricks) 2) Your program must have a good structure 3) You must code it very accurate, because it'll be very hard to find a mistake later So, hints: I. If your program works on 8*8 board it'll work on every board from 6*6 to 26*26 II. My program's structure is following: 1) if black pawn (BP) stops white pawn (WP) -> BLACK WINS 2) if BP bites WP -> BLACK WINS 3) if WP bites BP (on first move, of course) and saves itself (runs away from square and black king (BK) can't catch it after that) -> WHITE WINS 4) if BK is in square (it can catch WP) and BP cann't prevent it standing initially on BK's way -> BLACK WINS 5) if BP trasforms into other figuge (I considered that it transforms into queen) and bites WP -> BLACK WINS otherwise -> WHITE WINS III. Here are some tests for you on every case described above: 1) 8 a2 a7 h1 BLACK WINS 8 a6 a5 h1 WHITE WINS 2) 8 a3 b6 h1 BLACK WINS 8 a6 b6 h1 WHITE WINS 3) 8 d5 c6 f5 WHITE WINS 8 d5 c6 a5 WHITE WINS 4) 8 b4 d5 e4 WHITE WINS 8 b3 h7 f3 BLACK WINS 8 b2 h7 g2 WHITE WINS 5) 8 b4 b3 h2 BLACK WINS 8 b5 b3 h2 WHITE WINS 8 b5 b2 b3 WHITE WINS 8 a4 g3 h8 BLACK WINS 8 a4 g3 g2 WHITE WINS 8 a4 h3 h8 BLACK WINS 8 a4 h3 g2 WHITE WINS I hope if you program passes all theese tests it gets AC. Good luck :) With respect, Dmitry "Diman_YES" Kovalioff dimanyes@mail.ru http://uniteam.narod.ru8 d5 c6 f5 WHITE WINS no black wins. put it on the desk and move. Черный король рубит пешку в любом случае ******** ******** ******** *W**K*** ***B**** ******** ******** ******** ******** ******** ******** ******** *W*BK*** ******** ******** ******** ******** ******** ******** ******** ***B**** *W*K**** ******** ******** ******** ******** ******** ******** ***B**** ******** *WK***** ******** ******** ******** ******** ******** ***B**** ******** **K***** *W****** Black turn: blak king move to b8 Black win. White pawn is allowed to move to the fourth horizontal from the second, and black pawn is allowed to move to the (N-3)-rd horizontal row from the (N-1)-st. Could anyone explan it more clearly and fully ? Thanks a lot !!! > White pawn is allowed to move to the fourth horizontal from the > second, and black pawn is allowed to move to the (N-3)-rd horizontal > row from the (N-1)-st. > > Could anyone explan it more clearly and fully ? Thanks a lot !!! It means that according to the rules of chess the pawn may(and may not) move in the first time by 2 fields ahead, not by one as usual. It is olny the first move, no more. Understand now? Good Luck. IMHO, this task is quite simple - I've got AC after 2 sumbits. The main idea is to describe all variants on paper (there are not so many variants as it seems) and ACCURATELY code it. I've done it after 1.5 hours. Congratulations to Leonid Volkov - the task is rather good. P.S. I will send my solution to the first person who sends me 1230, 1231 and 1232-solutions on dimanyes@mail.ru :)))) > IMHO, this task is quite simple - I've got AC after 2 sumbits. The > main idea is to describe all variants on paper (there are not so many > variants as it seems) and ACCURATELY code it. I've done it after 1.5 > hours. Congratulations to Leonid Volkov - the task is rather good. > P.S. I will send my solution to the first person who sends me 1230, > 1231 and 1232-solutions on dimanyes@mail.ru :)))) Sorry, but it is impossible: I want to receive 1230, 1231 and 1232 solutions. P.S. These tasks are for 1228 and 1229, are they? > Sorry, but it is impossible: I want to receive 1230, 1231 and 1232 > solutions. > P.S. These tasks are for 1228 and 1229, are they? On all your tests, which I have found, my program works correctly, but alltimes I have got WA. Why? What about this test (8x8): WP: e5 BP: d6 BK: c6 WHITE WINS!!!!! but: WP: e4 BP: d5 BK: c5 BLACK WINS!!!!! May BK stand under check in initial position? Please give me tests on all cases, which you have accounted in your program. Tests are not a subject to be published, as you know :-) You may send me your program, and I'll try to find out, what's wrong. |
|