結果

問題 No.24 数当てゲーム
ユーザー jugemjugemjugemjugemjugemjugem
提出日時 2017-11-14 23:16:04
言語 Haskell
(9.8.2)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 9,154 ms
コンパイル使用メモリ 165,708 KB
実行使用メモリ 7,272 KB
最終ジャッジ日時 2023-08-16 13:16:09
合計ジャッジ時間 9,996 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,080 KB
testcase_01 AC 2 ms
6,972 KB
testcase_02 AC 2 ms
7,072 KB
testcase_03 AC 3 ms
7,144 KB
testcase_04 AC 2 ms
7,036 KB
testcase_05 AC 2 ms
7,184 KB
testcase_06 AC 2 ms
7,272 KB
testcase_07 AC 3 ms
7,076 KB
testcase_08 AC 3 ms
7,108 KB
testcase_09 AC 2 ms
7,032 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
import Control.Applicative
import Data.List

main = do
  t <- readLn
  x <- map words <$> replicateM t getLine

  putStrLn . show $ solve [0..9] (map toTuple x)

get1st (a,_,_,_,_) = a

solve :: [Int] -> [(Int,Int,Int,Int,String)] -> Int
solve (x:[]) _ = x
solve ns ((a,b,c,d,r):xs)
  | r == "NO" = solve (ns \\ [a,b,c,d]) xs
  | r == "YES" = solve (intersect ns [a,b,c,d]) xs

toTuple :: [String] -> (Int,Int,Int,Int,String)
toTuple (a:b:c:d:e:[])  = (read a,read b,read c,read d,e)
0