結果

問題 No.2602 Real Collider
ユーザー kotatsugamekotatsugame
提出日時 2024-01-12 22:09:47
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 898 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 79,744 KB
最終ジャッジ日時 2024-01-12 22:10:39
合計ジャッジ時間 50,175 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
16,256 KB
testcase_01 AC 88 ms
16,256 KB
testcase_02 AC 86 ms
16,256 KB
testcase_03 AC 88 ms
16,256 KB
testcase_04 AC 86 ms
16,256 KB
testcase_05 AC 85 ms
16,256 KB
testcase_06 AC 85 ms
16,256 KB
testcase_07 AC 85 ms
16,256 KB
testcase_08 AC 84 ms
16,256 KB
testcase_09 AC 85 ms
16,256 KB
testcase_10 AC 1,456 ms
79,744 KB
testcase_11 AC 645 ms
38,400 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 487 ms
29,824 KB
testcase_16 AC 699 ms
39,168 KB
testcase_17 AC 765 ms
39,680 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 855 ms
40,704 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 445 ms
29,824 KB
testcase_27 WA -
testcase_28 AC 665 ms
39,552 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 693 ms
39,168 KB
testcase_32 AC 602 ms
38,400 KB
testcase_33 AC 717 ms
39,168 KB
testcase_34 AC 688 ms
39,296 KB
testcase_35 AC 477 ms
29,696 KB
testcase_36 AC 415 ms
29,696 KB
testcase_37 AC 786 ms
39,552 KB
testcase_38 AC 778 ms
39,808 KB
testcase_39 AC 775 ms
39,552 KB
testcase_40 AC 397 ms
29,184 KB
testcase_41 AC 860 ms
40,320 KB
testcase_42 AC 668 ms
38,912 KB
testcase_43 AC 635 ms
39,040 KB
testcase_44 AC 862 ms
40,448 KB
testcase_45 AC 560 ms
37,504 KB
testcase_46 AC 540 ms
36,096 KB
testcase_47 AC 781 ms
39,680 KB
testcase_48 AC 600 ms
38,400 KB
testcase_49 AC 533 ms
35,584 KB
testcase_50 AC 429 ms
29,312 KB
testcase_51 AC 454 ms
29,568 KB
testcase_52 AC 331 ms
27,136 KB
testcase_53 AC 709 ms
39,168 KB
testcase_54 AC 561 ms
37,504 KB
testcase_55 AC 616 ms
38,528 KB
testcase_56 AC 620 ms
38,528 KB
testcase_57 AC 578 ms
38,144 KB
testcase_58 AC 278 ms
23,552 KB
testcase_59 AC 688 ms
39,040 KB
testcase_60 AC 571 ms
38,528 KB
testcase_61 AC 495 ms
34,304 KB
testcase_62 AC 715 ms
39,296 KB
testcase_63 AC 787 ms
40,064 KB
testcase_64 AC 938 ms
40,960 KB
testcase_65 AC 495 ms
34,176 KB
testcase_66 AC 772 ms
39,680 KB
testcase_67 AC 395 ms
29,184 KB
testcase_68 AC 452 ms
29,568 KB
testcase_69 AC 324 ms
27,392 KB
testcase_70 AC 394 ms
29,184 KB
testcase_71 AC 492 ms
29,824 KB
testcase_72 AC 690 ms
39,040 KB
testcase_73 AC 588 ms
38,272 KB
testcase_74 AC 705 ms
39,168 KB
testcase_75 AC 748 ms
39,552 KB
testcase_76 AC 661 ms
38,784 KB
testcase_77 AC 686 ms
39,040 KB
testcase_78 AC 850 ms
40,320 KB
testcase_79 AC 710 ms
39,424 KB
testcase_80 AC 819 ms
40,192 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

Q=gets.to_i
Inputs=gets(p).split.map(&:to_r)
def read()
  x,y=Inputs.shift(2)
  return x+y*1i
end
def assert(f)
  raise "Error" unless f
end
x=[read(),read(),read()]
assert(x.uniq.size==3)
def cross(a,b)
  return a.real*b.imag-a.imag*b.real
end
def parallel(a,b)
  return cross(a,b)==0
end
o=r=nil
if parallel(x[1]-x[0],x[2]-x[0])
  maxr=0
  x.combination(2).each{|a,b|
    d=(b-a).abs2
    if maxr<d
      maxr=d
      r=d/4
      o=(a+b)/2
    end
  }
  assert(x.map{|t|(o-t).abs2}.max==r)
else
  def line(x,y)
    a1=(x+y)/2
    t=y-x
    a2=Complex(a1.real-t.imag,a1.imag+t.real)
    return a1,a2
  end
  a1,a2=line(x[0],x[1])
  b1,b2=line(x[0],x[2])
  d1=cross(a2-a1,b1-a1)
  d2=-cross(a2-a1,b2-a1)
  assert(d1+d2!=0)
  o=b1+(b2-b1)*(d1/(d1+d2))
  r=x.map{|x|(x-o).abs2}
  assert(r.uniq.size==1)
  r=r.max
end
assert(Inputs.size==2*Q)
Q.times{
  d=(o-read()).abs2
  puts d<=r ? "Yes" : "No"
}
0