結果

問題 No.635 自然門松列
ユーザー tottoripapertottoripaper
提出日時 2018-01-20 02:32:22
言語 Haskell
(9.8.2)
結果
AC  
実行時間 12 ms / 650 ms
コード長 1,124 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 164,792 KB
実行使用メモリ 11,196 KB
最終ジャッジ日時 2023-09-05 13:10:59
合計ジャッジ時間 2,088 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,020 KB
testcase_01 AC 3 ms
7,080 KB
testcase_02 AC 3 ms
7,596 KB
testcase_03 AC 4 ms
7,908 KB
testcase_04 AC 4 ms
7,560 KB
testcase_05 AC 7 ms
11,024 KB
testcase_06 AC 12 ms
11,044 KB
testcase_07 AC 7 ms
11,016 KB
testcase_08 AC 4 ms
7,916 KB
testcase_09 AC 3 ms
7,944 KB
testcase_10 AC 7 ms
11,088 KB
testcase_11 AC 7 ms
11,076 KB
testcase_12 AC 7 ms
11,196 KB
testcase_13 AC 12 ms
11,096 KB
testcase_14 AC 7 ms
11,064 KB
testcase_15 AC 3 ms
7,212 KB
testcase_16 AC 2 ms
6,992 KB
testcase_17 AC 7 ms
11,088 KB
testcase_18 AC 7 ms
11,044 KB
testcase_19 AC 8 ms
11,096 KB
testcase_20 AC 8 ms
11,124 KB
testcase_21 AC 7 ms
11,016 KB
testcase_22 AC 7 ms
11,096 KB
testcase_23 AC 7 ms
11,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import           Control.Monad (replicateM)
import           Data.List     (nub)

data State = Short | Long | Mix | None
  deriving (Eq, Show)

f x y x1 y1
  | x < x1 = if y <= y1
             then Short
             else Mix
  | x == x1 = if y < y1
              then Short
              else if y == y1
                   then None
                   else Long
  | otherwise = if y < y1
                then Mix
                else Long
main = do
  n <- readLn
  replicateM n $ do
    [x2, x1, x3, y2, y1, y3] <- fmap (map read . words) getLine
    let s1 = f x2 y2 x1 y1
        s2 = f x3 y3 x1 y1
        can' = case (s1, s2) of
                 (Mix, _) -> True
                 (_, Mix) -> True
                 _        -> s1 == s2
        can = (maximum [ x1, x2, x3 ] == x1 || minimum [ x1, x2, x3 ] == x1) && length (nub [ x1, x2, x3 ]) == length [ x1, x2, x3 ] ||
              (maximum [ y1, y2, y3 ] == y1 || minimum [ y1, y2, y3 ] == y1) && length (nub [ y1, y2, y3 ]) == length [ y1, y2, y3 ] ||
              (x2 - x1) * (y3 - y1) /= (x3 - x1) * (y2 - y1) && can'
    putStrLn $ if can then "YES" else "NO"
0