結果

問題 No.750 Frac #1
ユーザー ducktailducktail
提出日時 2018-11-09 21:39:42
言語 Haskell
(9.2.2)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 384 bytes
コンパイル時間 2,432 ms
使用メモリ 4,420 KB
最終ジャッジ日時 2022-12-26 19:47:07
合計ジャッジ時間 2,714 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
4,136 KB
testcase_01 AC 2 ms
4,116 KB
testcase_02 AC 2 ms
4,192 KB
testcase_03 AC 2 ms
4,164 KB
testcase_04 AC 2 ms
4,116 KB
testcase_05 AC 2 ms
4,360 KB
testcase_06 AC 2 ms
4,396 KB
testcase_07 AC 2 ms
4,212 KB
testcase_08 AC 2 ms
4,092 KB
testcase_09 AC 2 ms
4,168 KB
testcase_10 AC 2 ms
4,220 KB
testcase_11 AC 2 ms
4,364 KB
testcase_12 AC 2 ms
4,120 KB
testcase_13 AC 2 ms
4,340 KB
testcase_14 AC 2 ms
4,112 KB
testcase_15 AC 2 ms
4,100 KB
testcase_16 AC 2 ms
4,228 KB
testcase_17 AC 2 ms
4,420 KB
testcase_18 AC 2 ms
4,108 KB
testcase_19 AC 2 ms
4,140 KB
testcase_20 AC 2 ms
4,112 KB
testcase_21 AC 2 ms
4,168 KB
testcase_22 AC 2 ms
4,192 KB
testcase_23 AC 2 ms
4,412 KB
testcase_24 AC 2 ms
4,180 KB
testcase_25 AC 2 ms
4,344 KB
testcase_26 AC 2 ms
4,200 KB
testcase_27 AC 2 ms
4,328 KB
testcase_28 AC 2 ms
4,156 KB
testcase_29 AC 2 ms
4,068 KB
testcase_30 AC 2 ms
4,368 KB
testcase_31 AC 2 ms
4,240 KB
testcase_32 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.2.2/environments/default
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking a.out ...

ソースコード

diff #

import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
  n <- readLn
  solve <$> replicateM n f >>= mapM_ (putStrLn . unwords . map show) 
  where
    f = map read <$> words <$> getLine

solve :: [[Int]] -> [[Int]]
solve = sortBy f
  where
    f [a1, b1] [a2, b2]
      | a1 * b2 > a2 * b1 = LT
      | a1 * b2 < a2 * b1 = GT
      | otherwise = EQ
0