|
|
вернуться в форумWA#2, HELP!!!! Послано ZiV 17 дек 2005 00:41 Please help me, what is wrong with my solution.... Const MaxN = 100000; Var b : array[1..MaxN] of boolean; c : array[1..2,1..MaxN] of longint; c_num,n,m,i,x,y : longint; BEGIN Readln(n,m); Fillchar(b,sizeof(b),true); Fillchar(c,sizeof(c),0); c_num := 0; For i := 1 to m do begin Read(x,y); if b[x] and b[y] then Begin Inc(c_num); c[1][c_num] := x; c[2][c_num] := y; b[x] := false; b[y] := false; End; End; Writeln(c_num); For i := 1 to C_num do Begin Writeln(c[1][i],' ',c[2][i]); End; END. Re: WA#2, HELP!!!! Try such test... :) 4 3 2 3 1 2 3 4 Correct answer is 2 1 2 3 4 I don't think, that greedy is a good idea... Re: WA#2, HELP!!!! Try this one 4 3 1 2 1 3 3 4 Correct Answer: 2 1 2 3 4 |
|
|