結果

問題 No.24 数当てゲーム
ユーザー jugemjugemjugemjugemjugemjugem
提出日時 2017-11-11 17:56:58
言語 Haskell
(9.6.2)
結果
RE  
実行時間 -
コード長 560 bytes
コンパイル時間 4,721 ms
コンパイル使用メモリ 164,344 KB
実行使用メモリ 7,124 KB
最終ジャッジ日時 2023-08-16 07:43:00
合計ジャッジ時間 5,686 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,020 KB
testcase_01 AC 2 ms
7,100 KB
testcase_02 AC 3 ms
7,016 KB
testcase_03 AC 3 ms
7,124 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 2 ms
7,040 KB
testcase_07 AC 2 ms
7,092 KB
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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] [0..9] (map toTuple x)

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

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