結果

問題 No.1041 直線大学
ユーザー cunitac
提出日時 2020-05-01 21:47:48
言語 Haskell
(9.10.1)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 12,784 ms
コンパイル使用メモリ 173,696 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2024-11-16 07:53:13
合計ジャッジ時間 13,441 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Monad

solve n ps = maximum [f (p, q) | p<-ps, q<-ps, p/=q] where
  f ((x1, y1), (x2, y2)) = length $ filter g ps where
    g (x, y) = (x2 - x1) * (y - y1) == (y2 - y1) * (x - x1)

main = do
  n <- readLn
  ps <- replicateM n $
    (\[x,y]->(x,y)).map read.words <$> getLine
  print $ solve n ps
0