結果

問題 No.635 自然門松列
ユーザー finefine
提出日時 2018-01-21 02:01:31
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 63 ms
コンパイル使用メモリ 11,528 KB
実行使用メモリ 15,280 KB
最終ジャッジ日時 2023-08-26 16:31:51
合計ジャッジ時間 3,690 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,072 KB
testcase_01 AC 88 ms
15,272 KB
testcase_02 AC 83 ms
15,192 KB
testcase_03 AC 82 ms
15,276 KB
testcase_04 AC 82 ms
15,056 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 83 ms
15,120 KB
testcase_09 AC 82 ms
15,224 KB
testcase_10 WA -
testcase_11 AC 84 ms
15,280 KB
testcase_12 AC 83 ms
15,096 KB
testcase_13 AC 85 ms
15,212 KB
testcase_14 AC 84 ms
15,188 KB
testcase_15 WA -
testcase_16 AC 82 ms
15,096 KB
testcase_17 AC 85 ms
15,132 KB
testcase_18 AC 86 ms
15,156 KB
testcase_19 AC 85 ms
15,188 KB
testcase_20 AC 87 ms
15,100 KB
testcase_21 AC 84 ms
15,140 KB
testcase_22 WA -
testcase_23 AC 86 ms
15,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

INF = 1000000000
def solve(x1, x2, x3, y1, y2, y3)
    if (x1 == x2 && y1 == y2) || (x3 == x2 && y3 == y2) || (x1 == x3 && y1 == y3)
        return false
    end
    v1 = y1 * INF + x1
    v2 = y2 * INF + x2
    v3 = y3 * INF + x3
    if (v2 < v1 && v2 < v3) || (v2 > v1 && v2 > v3)
        return true
    end
    if y1 == y2 || y3 == y2
        return false
    end
    f1 = -1.0 * (x1 - x2) / (y1 - y2)
    f3 = -1.0 * (x3 - x2) / (y3 - y2) 
    return [f1, f3].max >= 0
end

n = gets.to_i
n.times do |i|
    puts solve(*gets.split.map(&:to_i)) ? "YES" : "NO"
end
0