|
|
back to boardwhy i got WA ? who can help me? var i,j,k,n,m,s:longint; xx:real; x,y:array[0..1000] of real; a:Array[0..1000] of integer; an:array[0..1000] of real; d:array[0..1000] of integer; begin readln(x[0],y[0]); readln(n); for i:=1 to n do readln(x[i],y[i],d[i]); for i:=1 to n do begin x[i]:=x[i]-x[0]; y[i]:=y[i]-y[0]; end; for i:=1 to n do for j:=i+1 to n do if ((x[i]=x[j]) and (y[i]=y[j])) or ((x[i]=0) and (y[i]=0))then begin writeln(-1); halt; end; writeln(0); fillchar(a,sizeof(a),0); fillchar(an,sizeof(an),0); s:=0; for i:=1 to n do if (x[i]=0) and (y[i]>0) then writeln(i); for i:=1 to n do if (x[i]>0) and (y[i]>=0) then begin inc(s); a[s]:=i; an[s]:=arctan(y[i]/x[i]); end; for i:=1 to s-1 do for j:=1 to s-i do if an[j]<an[j+1] then begin k:=a[j]; a[j]:=a[j+1]; a[j+1]:=k; xx:=an[j]; an[j]:=an[j+1]; an[j+1]:=xx; end; for i:=1 to s do writeln(d[a[i]]); fillchar(a,sizeof(a),0); fillchar(an,sizeof(an),0); s:=0; for i:=1 to n do if (x[i]>0) and (y[i]<0) then begin inc(s); a[s]:=i; an[s]:=arctan(-1*y[i]/x[i]); end; for i:=1 to s-1 do for j:=1 to s-i do if an[j]>an[j+1] then begin k:=a[j]; a[j]:=a[j+1]; a[j+1]:=k; xx:=an[j]; an[j]:=an[j+1]; an[j+1]:=xx; end; for i:=1 to s do writeln(d[a[i]]); for i:=1 to n do if (x[i]=0) and (y[i]<0) then writeln(i); fillchar(a,sizeof(a),0); fillchar(an,sizeof(an),0); s:=0; for i:=1 to n do if (x[i]<0) and (y[i]<=0) then begin inc(s); a[s]:=i; an[s]:=arctan(y[i]/x[i]); end; for i:=1 to s-1 do for j:=1 to s-i do if an[j]<an[j+1] then begin k:=a[j]; a[j]:=a[j+1]; a[j+1]:=k; xx:=an[j]; an[j]:=an[j+1]; an[j+1]:=xx; end; for i:=1 to s do writeln(d[a[i]]); fillchar(a,sizeof(a),0); fillchar(an,sizeof(an),0); s:=0; for i:=1 to n do if (x[i]<0) and (y[i]>0) then begin inc(s); a[s]:=i; an[s]:=arctan(-1*y[i]/x[i]); end; for i:=1 to s-1 do for j:=1 to s-i do if an[j]>an[j+1] then begin k:=a[j]; a[j]:=a[j+1]; a[j+1]:=k; xx:=an[j]; an[j]:=an[j+1]; an[j+1]:=xx; end; for i:=1 to s do writeln(d[a[i]]); writeln(0); end. |
|
|