|
|
4 3 1 2 2 3 3 4 Luck is possible 5 10 1 2 1 3 1 4 1 5 2 3 2 4 2 5 3 4 3 5 4 5 -> Unlucky Petr Is a non-linear tree! Edited by author 12.09.2016 06:14 My solution: checked every component graph, 1) if subgraph = Full graph, yes else 2) if subgraph = linear graph, yes else no. this is right? sorry, my bad english. First condition is true only for full graph with 3 or 4 vertices. 1) and 2) are right. but there exists another lucky graphs. i've got WA7 and i think test#7 is not a full graph or linear. I got AC with only statements written above. Read them more attentively: every connected component of this graph should satisfy them, not entire graph. WA#7 trees aren't linear :) Edited by author 12.09.2016 05:58 god! help! I don't understand the meaning of the problem. Why output to syserr cause wa#1? Is it working as intended? 3- TEST NIMA? WHAT IS 3 TEST REAL I think there are sets of unconnected points. They are lucky, i think test#3 is a M=0. it's lucky. HERE is my code var n,m,i,k:integer; x,y:array [1..10000] of integer; begin readln(n,m); k:=0; for i:=1 to m do begin readln(x[i],y[i]); if abs(x[i]-y[i])=1 then k:=k+1; if abs(x[i]-y[i])=n-1 then k:=k+1; end; if (k=n) and (k<=m) then writeln('Luck is possible') else writeln('Unlucky Petr'); readln; readln; end. i think you haven't understood the task correctly. If you are interested, write to i.ju.olshvang[at]gmail[dot]com or icq#344303921, i'll try to make it clear to you. |
|
|