結果

問題 No.133 カードゲーム
ユーザー aimy
提出日時 2017-05-02 16:21:06
言語 Haskell
(9.10.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 416 bytes
コンパイル時間 5,739 ms
コンパイル使用メモリ 173,440 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 03:48:58
合計ジャッジ時間 6,614 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Data.List
import Control.Monad

fact n = product [1..n]

main = do
 n <- readLn
 as <- map read . words <$> getLine
 bs <- map read . words <$> getLine
 print (game n as bs)

game :: Int -> [Int] -> [Int] -> Double
game n as bs = (/ (fromIntegral ((fact n)^2))) $ fromIntegral $ length $ do
 as' <- permutations as
 bs' <- permutations bs
 guard $ length (filter id (zipWith (>) as' bs')) > div n 2
 return ()
0