結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
16,256 KB
testcase_01 AC 86 ms
16,256 KB
testcase_02 AC 86 ms
16,256 KB
testcase_03 AC 116 ms
16,256 KB
testcase_04 AC 83 ms
16,256 KB
testcase_05 AC 84 ms
16,256 KB
testcase_06 AC 85 ms
16,256 KB
testcase_07 AC 89 ms
16,256 KB
testcase_08 AC 85 ms
16,256 KB
testcase_09 AC 83 ms
16,256 KB
testcase_10 AC 1,437 ms
79,744 KB
testcase_11 AC 636 ms
38,400 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 507 ms
29,696 KB
testcase_16 AC 697 ms
39,168 KB
testcase_17 AC 779 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 443 ms
29,824 KB
testcase_27 WA -
testcase_28 AC 676 ms
39,552 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 719 ms
39,168 KB
testcase_32 AC 638 ms
38,400 KB
testcase_33 AC 707 ms
39,168 KB
testcase_34 AC 708 ms
39,296 KB
testcase_35 AC 477 ms
29,696 KB
testcase_36 AC 435 ms
29,696 KB
testcase_37 AC 765 ms
39,552 KB
testcase_38 AC 807 ms
39,808 KB
testcase_39 AC 773 ms
39,552 KB
testcase_40 AC 419 ms
29,184 KB
testcase_41 AC 873 ms
40,320 KB
testcase_42 AC 677 ms
38,912 KB
testcase_43 AC 659 ms
39,040 KB
testcase_44 AC 890 ms
40,448 KB
testcase_45 AC 579 ms
37,376 KB
testcase_46 AC 545 ms
36,096 KB
testcase_47 AC 811 ms
39,680 KB
testcase_48 AC 606 ms
38,400 KB
testcase_49 AC 546 ms
35,584 KB
testcase_50 AC 429 ms
29,312 KB
testcase_51 AC 465 ms
29,568 KB
testcase_52 AC 332 ms
27,136 KB
testcase_53 AC 722 ms
39,168 KB
testcase_54 AC 567 ms
37,376 KB
testcase_55 AC 637 ms
38,528 KB
testcase_56 AC 632 ms
38,528 KB
testcase_57 AC 587 ms
38,144 KB
testcase_58 AC 276 ms
23,552 KB
testcase_59 AC 686 ms
39,040 KB
testcase_60 AC 597 ms
38,528 KB
testcase_61 AC 496 ms
34,304 KB
testcase_62 AC 755 ms
39,296 KB
testcase_63 AC 808 ms
40,064 KB
testcase_64 AC 924 ms
40,960 KB
testcase_65 AC 508 ms
34,176 KB
testcase_66 AC 756 ms
39,680 KB
testcase_67 AC 404 ms
29,184 KB
testcase_68 AC 440 ms
29,568 KB
testcase_69 AC 330 ms
27,392 KB
testcase_70 AC 398 ms
29,184 KB
testcase_71 AC 491 ms
29,824 KB
testcase_72 AC 699 ms
39,040 KB
testcase_73 AC 587 ms
38,144 KB
testcase_74 AC 723 ms
39,168 KB
testcase_75 AC 750 ms
39,552 KB
testcase_76 AC 711 ms
38,784 KB
testcase_77 AC 701 ms
39,040 KB
testcase_78 AC 890 ms
40,320 KB
testcase_79 AC 763 ms
39,424 KB
testcase_80 AC 822 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
x=[read(),read(),read()]
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
  }
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)
  o=b1+(b2-b1)*(d1/(d1+d2))
  r=x.map{|x|(x-o).abs2}.max
end
Q.times{
  d=(o-read()).abs2
  puts d<=r ?"Yes":"No"
}
0