結果

問題 No.622 点と三角柱の内外判定
ユーザー tailstails
提出日時 2017-12-22 00:23:32
言語 Perl
(5.38.2)
結果
AC  
実行時間 7 ms / 1,500 ms
コード長 800 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 5,372 KB
実行使用メモリ 5,408 KB
最終ジャッジ日時 2023-08-22 21:10:25
合計ジャッジ時間 2,817 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,372 KB
testcase_01 AC 6 ms
5,232 KB
testcase_02 AC 6 ms
5,208 KB
testcase_03 AC 6 ms
5,120 KB
testcase_04 AC 6 ms
5,300 KB
testcase_05 AC 6 ms
5,096 KB
testcase_06 AC 6 ms
5,184 KB
testcase_07 AC 6 ms
5,228 KB
testcase_08 AC 6 ms
5,176 KB
testcase_09 AC 6 ms
5,184 KB
testcase_10 AC 6 ms
5,184 KB
testcase_11 AC 6 ms
5,120 KB
testcase_12 AC 6 ms
5,228 KB
testcase_13 AC 6 ms
5,332 KB
testcase_14 AC 6 ms
5,344 KB
testcase_15 AC 6 ms
5,272 KB
testcase_16 AC 6 ms
5,204 KB
testcase_17 AC 6 ms
5,116 KB
testcase_18 AC 6 ms
5,356 KB
testcase_19 AC 6 ms
5,280 KB
testcase_20 AC 6 ms
5,176 KB
testcase_21 AC 6 ms
5,272 KB
testcase_22 AC 6 ms
5,344 KB
testcase_23 AC 7 ms
5,096 KB
testcase_24 AC 6 ms
5,256 KB
testcase_25 AC 6 ms
5,276 KB
testcase_26 AC 6 ms
5,096 KB
testcase_27 AC 6 ms
5,176 KB
testcase_28 AC 6 ms
5,296 KB
testcase_29 AC 6 ms
5,408 KB
testcase_30 AC 6 ms
5,124 KB
testcase_31 AC 6 ms
5,296 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

($x1,$y1,$z1)=glob<>;
($x2,$y2,$z2)=glob<>;
($x3,$y3,$z3)=glob<>;
($x4,$y4,$z4)=glob<>;

$x12=$x2-$x1;
$y12=$y2-$y1;
$z12=$z2-$z1;
$x23=$x3-$x2;
$y23=$y3-$y2;
$z23=$z3-$z2;
$x31=$x1-$x3;
$y31=$y1-$y3;
$z31=$z1-$z3;
$nx=$y12*$z23-$y23*$z12;
$ny=$z12*$x23-$z23*$x12;
$nz=$x12*$y23-$x23*$y12;
$n12x=$ny*$z12-$nz*$y12;
$n12y=$nz*$x12-$nx*$z12;
$n12z=$nx*$y12-$ny*$x12;
$n23x=$ny*$z23-$nz*$y23;
$n23y=$nz*$x23-$nx*$z23;
$n23z=$nx*$y23-$ny*$x23;
$n31x=$ny*$z31-$nz*$y31;
$n31y=$nz*$x31-$nx*$z31;
$n31z=$nx*$y31-$ny*$x31;
$x41=$x1-$x4;
$y41=$y1-$y4;
$z41=$z1-$z4;
$x42=$x2-$x4;
$y42=$y2-$y4;
$z42=$z2-$z4;
$x43=$x3-$x4;
$y43=$y3-$y4;
$z43=$z3-$z4;
$s1=$x41*$n12x+$y41*$n12y+$z41*$n12z > 0;
$s2=$x42*$n23x+$y42*$n23y+$z42*$n23z > 0;
$s3=$x43*$n31x+$y43*$n31y+$z43*$n31z > 0;

print $s1==$s2&&$s1==$s3?YES:NO
0