Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | To Admins: Please check 1 and 4 tests in problem 1072 | vetas | 1072. Маршрутизация | 23 янв 2009 22:26 | 2 | In 1 test in last row content's tab symbol's (\9) In 4 test count of interface > 5. ( When I description: struct Data { ... public uint[] intf = new uint[5]; } have Crash(4)
When I description: struct Data { ... public uint[] intf = new uint[50]; } have Accepted ) Testset is correct. You have changed not only this constant to get AC. | To ADMINS: Java solutions | HonoraryCoder | 1072. Маршрутизация | 25 июл 2008 13:09 | 2 | Edited by author 28.10.2008 13:18 | WA #2 Is any good tests? | beststu | 1072. Маршрутизация | 3 апр 2008 14:52 | 1 | | Why I get WA? Pelase, help me!!!!!!! | Revenger and NSC | 1072. Маршрутизация | 30 июн 2007 14:27 | 6 | There is my solution: Program t1072; Const MaxN=100; MaxK=10; Type TCPIP=record IP,Mask :array[1..4]of longint end; Var N,K,i,j,count :longint; S :string[255]; Route :array[1..MaxN,1..MaxN]of boolean; MinWay :array[1..MaxN]of longint; PredWay :array[1..MaxN]of longint; Comp1,Comp2 :longint; Next :longint; Way :array[1..MaxN]of longint; ex :boolean; net :array[1..MaxN]of record K :longint; TCP_IP :array[1..MaxK]of TCPIP; end; Function SameNet(_IP1,_IP2:TCPIP):boolean; var r1,r2,r3,r4 :boolean; begin r1:= (_IP1.IP[1] AND _IP1.Mask[1]) = (_IP2.IP[1] AND _IP2.Mask[1]); r2:= (_IP1.IP[2] AND _IP1.Mask[2]) = (_IP2.IP[2] AND _IP2.Mask[2]); r3:= (_IP1.IP[3] AND _IP1.Mask[3]) = (_IP2.IP[3] AND _IP2.Mask[3]); r4:= (_IP1.IP[4] AND _IP1.Mask[4]) = (_IP2.IP[4] AND _IP2.Mask[4]); SameNet:= r1 AND r2 AND r3 AND r4 ; end; Function InSameNet(comp1,comp2 :longint):boolean; var i1,i2 :longint; ok :boolean; begin for i1:=1 to net[comp1].K do for i2:=1 to net[comp2].K do if SameNet(net[comp1].TCP_IP[i1],net[comp2].TCP_IP[i2]) then begin InSameNet:=true; exit; end; InSameNet:=false; end; Procedure MakeTCP(S:string;Var D :TCPIP); var n1,n2,n3,n4 :longint; t1,t2,t3,t4 :longint; CurNum :string[255]; i,j,code :longint; begin j:=1; while S[j]=' ' do j:=j+1; CurNum:=''; for i:=j to length(S) do if S[i]<>'.' then CurNum:=CurNum+S[i] else break; j:=i+1; val(CurNum,n1,code); CurNum:=''; for i:=j to length(S) do if S[i]<>'.' then CurNum:=CurNum+S[i] else break; j:=i+1; val(CurNum,n2,code); CurNum:=''; for i:=j to length(S) do if S[i]<>'.' then CurNum:=CurNum+S[i] else break; j:=i+1; val(CurNum,n3,code); CurNum:=''; for i:=j to length(S) do if S[i]<>' ' then CurNum:=CurNum+S[i] else break; j:=i+1; val(CurNum,n4,code); while S[j]=' ' do j:=j+1; CurNum:=''; for i:=j to length(S) do if S[i]<>'.' then CurNum:=CurNum+S[i] else break; j:=i+1; val(CurNum,t1,code); CurNum:=''; for i:=j to length(S) do if S[i]<>'.' then CurNum:=CurNum+S[i] else break; j:=i+1; val(CurNum,t2,code); CurNum:=''; for i:=j to length(S) do if S[i]<>'.' then CurNum:=CurNum+S[i] else break; j:=i+1; val(CurNum,t3,code); CurNum:=''; for i:=j to length(S) do if S[i]<>' ' then CurNum:=CurNum+S[i] else break; val(CurNum,t4,code); D.IP[1]:=n1; D.IP[2]:=n2; D.IP[3]:=n3; D.IP[4]:=n4; D.Mask[1]:=t1; D.Mask[2]:=t2; D.Mask[3]:=t3; D.Mask[4]:=t4; end; begin Assign(input,'1072.in');ReSet(input); for i:=1 to MaxN do for j:=1 to MaxN do Route[i,j]:=false; Readln(N); for i:=1 to N do begin Readln(K); net[i].K:=K; for j:=1 to K do begin Readln(S); MakeTCP(S,net[i].TCP_IP[j]); end; end; Read(Comp1,Comp2); if comp1=comp2 then begin Writeln('YES'); Writeln(comp1); Halt(0); end; for i:=1 to N do for j:=1 to N do if i<>j then Route[i,j]:=InSameNet(i,j); for i:=1 to MaxN do MinWay[i]:=-1; for i:=1 to MaxN do PredWay[i]:=0; count:=0; MinWay[comp1]:=1; repeat ex:=true; count:=count+1; for i:=1 to N do if MinWay[i]=count then for j:=1 to N do if Route[i,j] then if MinWay[j]=-1 then begin MinWay[j]:=count+1; PredWay[j]:=i; ex:=false; end; until ex; if MinWay[comp2]=-1 then writeln('NO') else begin Next:=comp2; j:=MinWay[comp2]+1; while Next<>0 do begin j:=j-1; Way[j]:=Next; Next:=PredWay[Next]; end; writeln('YES'); i:=0; for i:=1 to MinWay[comp2]-1 do write(Way[i],' ') | What answer first test? | AndrewSt(ArcSTU) | 1072. Маршрутизация | 9 апр 2007 04:07 | 1 | There can be I write the answer not correctly? | why wa on #4???r there any tricks??? | Anlayzer | 1072. Маршрутизация | 26 мар 2007 01:10 | 2 | i just use bfs!!!can someone tell me why i got wa on #4? [code deleted] Edited by moderator 13.02.2007 20:53 You must be attantive with reading data and making edges in graph really, also try to check your output Edited by author 26.03.2007 01:10 | Why WA help me please | The Punisher | 1072. Маршрутизация | 29 май 2006 18:59 | 1 | got AC Edited by author 29.01.2007 23:32 Edited by author 29.01.2007 23:32 | What I must print if there are not one shortest way? For example: | Nazar | 1072. Маршрутизация | 24 сен 2005 23:50 | 2 | 4 1 1.1.1.1 1.1.1.1 2 1.1.1.1 1.1.1.1 2.2.2.2 2.2.2.2 2 1.1.1.1 1.1.1.1 2.2.2.2 2.2.2.2 1 2.2.2.2 2.2.2.2 1 4 There is two posible answers: #1: Yes 1 2 4 #2: Yes 1 3 4 Which one i have print? | why I get WA on #4 ? | thwomass | 1072. Маршрутизация | 25 июл 2005 22:59 | 3 | At first I got WA#4. Then I solved this problem 2 days... My algoritm was correct!!! But I again WA#4. I think Test#4 is incorrect, because the problem has some answers!!! Admins, please, to correct this promlem!!! Sorry for my bad English... P.S. I got AC :-) | WA 5. Maybe i read incorrect data? | Lifanov | 1072. Маршрутизация | 2 апр 2005 17:54 | 2 | unsigned int convert(char *a){ unsigned int S=0,t; int j=0; for(int i=0;i<3;i++){ S*=256; t=0; while(a[j]!='.'){ t+=a[j]-'0'; t*=10; j++; } S+=t; } j=0; t=0; for(;j<strlen(a);j++){ t*=10; t+=a[j]-'0'; } S*=256; S+=t; return S; } void read(int n){ // n -index PC int k,i; char ip[100],mask[100]; scanf("%d",&k); Count[n]=k; for(i=0;i<k;i++){ scanf("%s %s",ip,mask); IP[n][i]=convert(ip); Mask[n][i]=convert(mask); // printf("%s %s %u %u\n",ip,mask,IP[n][i],Mask[n][i]); } } | HELP! Why BFS get WA? | Yoyo | 1072. Маршрутизация | 25 окт 2004 20:51 | 2 | H E L P!!!!!!!!!!!!!!!!!!!!!!!!!!! Edited by author 25.10.2004 20:51 | Help! Where is that mistake?!!! (Code attached) | Alex[LSD] | 1072. Маршрутизация | 30 июн 2002 23:16 | 1 | { Its quite simple. We read the info about the computers. Then we use a lousy N^3 algorythm to find the shortest way between the 2 computers. This all should work but it doesnt...} Program acm_1072; {Routing} Type comp = Record Inter:array [1..5,1..4] of byte; Mask :array [1..5,1..4] of byte; End; Var N :integer; A :array [1..100] of comp; C :array [1..100] of integer; i,j,k,l :integer; from :array [1..100] of integer; con :array [1..100,1..100] of boolean; First,last :integer; Function Numb(x:char):boolean; Begin Numb:=(x>='0')and(x<='9'); End; Function Compatible(n1,c1,n2,c2:integer):boolean; Var i,k :integer; ok1,ok2,ok3,ok4:boolean; Begin ok1:=(A[n1].inter[c1,1] AND A[n1].mask[c1,1])=(A[n2].inter[c2,1] AND A[n2].mask[c2,1]); ok2:=(A[n1].inter[c1,2] AND A[n1].mask[c1,2])=(A[n2].inter[c2,2] AND A[n2].mask[c2,2]); ok3:=(A[n1].inter[c1,3] AND A[n1].mask[c1,3])=(A[n2].inter[c2,3] AND A[n2].mask[c2,3]); ok4:=(A[n1].inter[c1,4] AND A[n1].mask[c1,4])=(A[n2].inter[c2,4] AND A[n2].mask[c2,4]); Compatible:=ok1 AND ok2 AND ok3 AND ok4; End; Procedure ReadComp(x:integer); Var i,j,k,l :integer; num :integer; S,S1 :string; Begin ReadLN(K); C[x]:=K; For i:=1 to K do Begin ReadLn(S); S:=S+' '; For j:=1 to 4 do Begin {Chitaem j-i bait} While ( not numb(S[1]) ) do delete(S,1,1); S1:=''; While Numb(S[1]) do Begin S1:=S1+S[1]; Delete(s,1,1); End; val(S1,A[x].inter[i,j],l); End; For j:=1 to 4 do Begin {Chitaem j-i bait} While ( not numb(S[1]) ) do delete(S,1,1); S1:=''; While Numb(S[1]) do Begin S1:=S1+S[1]; Delete(s,1,1); End; val(S1,A[x].mask[i,j],l); End; End; End; Begin ReadLn(N); For i:=1 to N do ReadComp(i); Fillchar(con,sizeof(Con),0); For i:=1 to N do For j:=i to N do For k:=1 to C[i] do For l:=1 to C[j] do If Compatible(i,k,j,l) then Begin con[i,j]:=true; Con [j,i]:=true; End; For i:=1 to N do C[i]:=200; Read(First,Last); C[Last]:=1; i:=1; While i<>0 do Begin i:=0; For j:=1 to N do For k:=1 to N do If (Con[j,k])and(C[k]>C[j]+1) then Begin From[k]:=j; i:=1; C[k]:=C[j]+1; End; End; If C[First]=200 then Begin Writeln('No'); Halt(0); End; Writeln('Yes'); k:=First; For i:=1 to C[First] do Begin If i<>c[first] then Write(k,' ') Else Write(k); K:=From[k]; End; End. | Что за косяк? | Andrew V. Lazarev | 1072. Маршрутизация | 11 мар 2001 22:17 | 3 | Ну я не знаю. Облажаться в обходе в ширину по-моему невозможно. Или я чего-то не понимаю? > Ну я не знаю. Облажаться в обходе в ширину по-моему > невозможно. Или я чего-то не понимаю? > Ну я не знаю. Облажаться в обходе в ширину по-моему > невозможно. Или я чего-то не понимаю? |
|
|