結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2015-10-26 19:15:22 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 492 bytes |
| コンパイル時間 | 7,067 ms |
| コンパイル使用メモリ | 173,184 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 03:43:06 |
| 合計ジャッジ時間 | 6,271 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
コンパイルメッセージ
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
ソースコード
import Data.List (sort)
judge :: String -> Int -> String -> String
judge sb n sa
| n == 0 = if sb == sa then f else s
| n >= 2 = if cond2 then f else s
| n == 1 = if cond1 then f else s
where
(cb1 : cb2 : cb3 : _) = sb
cond1 = sa == [cb2, cb1, cb3] || sa == [cb1, cb3, cb2]
cond2 = sort sb == sort sa
s = "SUCCESS"
f = "FAILURE"
main :: IO ()
main = do
sb <- getLine
n <- readLn
sa <- getLine
putStrLn $ judge sb n sa
はむ吉🐹