Help, please. Here is my programme: ( When submit, I read standard input } const max = 11; dx :array[1..4] of integer = (1,0,-1,0); dy :array[1..4] of integer = (0,-1,0,1); huong : array[1..4] of char = ( 'R', 'B', 'L', 'T' ); vt = 'RBLT'; fi = 'image.inp'; var bang :array[0..max,0..max] of byte; st :array[1..max*max] of string[5]; q :array[1..max*max] of record x,y :longint end; n,a,b,kieu,so :longint; f :text; procedure doc_1; var i,x,y :longint; begin for i := 1 to n do begin readln(f, x, y); bang[x,y] := 1; if i = 1 then begin a := x; b := y; end; end; end; procedure doc_2; begin n := 0; repeat inc(n); readln(f, st[n]); until st[n] = '.'; end; procedure input; begin fillchar(bang, sizeof(bang), 0); assign(f, fi); reset(f); read(f, a); if eoln(f) then begin n := a; kieu := 1; doc_1; end else begin readln(f, b); kieu := 2; doc_2; end; close(f); end; procedure add(x,y,t :longint); begin inc(so); q[so].x := x; q[so].y := y; bang[x,y] := t; end; procedure ghi(i :longint); var j :byte; x,y :longint; begin if i = n then begin writeln('.'); exit; end; for j := 1 to 4 do begin x := q[i].x + dx[j]; y := q[i].y + dy[j]; if bang[x,y] = 1 then begin write( huong[j] ); add( x, y, 0); end; end; writeln(','); ghi(i+1); end; procedure ma1; begin so := 0; add( a, b, 0); writeln(a,' ',b); ghi(1); end; procedure duyet(i :longint); var j,t,x,y :longint; c :char; begin for j := 1 to length( st[i] ) - 1 do begin c := st[i][j]; t := pos(c, vt); x := q[i].x + dx[t]; y := q[i].y + dy[t]; if bang[x,y] = 0 then add( x, y, 1); end; if i < n then duyet(i+1); end; procedure ma2; var i,j :longint; begin so := 0; add(a,b,1); duyet(1); writeln(n); for i := 1 to max do for j := 1 to max do if bang[i,j] = 1 then writeln(i,' ',j); end; begin input; case kieu of 1 : ma1; 2 : ma2; end; end. Here's a test for you (+) Well, this is really strange, and I can't tell you what's wrong about your problem. But I can give you a test which might help you to find out what's the problem: 14 1 1 1 2 1 3 2 2 3 2 3 3 3 4 3 5 4 2 4 4 5 2 5 3 5 4 Here's the answer of your program: 1 1 T, RT, R, , RT, R, T, T, RT, T, , , , . Here's the correct answer: 1 1 T, RT, R, , RT, R, T, T, RT, T, , , . As you can see, you have one extra comma in your answer Good luck! Sorry but your test is wrong, RM your test notice that there are 14 points but it defines only 13 points. Anyway, thank you for your help. Could you please give me another test that make my program false? Ooops :) I'm sorry. Here's another one (+) I think that the point is here: "Neighbors are listed counter-clockwise starting with the right" Try this one: 6 2 4 3 3 3 4 3 5 4 3 4 2 Here's the answer of your program: 2 4 R, BT, R, , B, . Here's the answer of mine: 2 4 R, TB, , R, B, . I hope this test is the one you need :) Good luck! To shitty.Mishka Posted by hpfdf 3 Dec 2006 18:15 My answer is the same as yours. But i still got WA. Re: To shitty.Mishka My answer is the same as his. But I got Crash!! Re: Ooops :) I'm sorry. Here's another one (+) shitty.Mishka I think your test is wrong because the input is not sorted:) |