結果
| 問題 | No.197 手品 |
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2015-10-26 19:15:22 |
| 言語 | Haskell (9.14.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 492 bytes |
| 記録 | |
| コンパイル時間 | 1,007 ms |
| コンパイル使用メモリ | 195,712 KB |
| 実行使用メモリ | 203,680 KB |
| 最終ジャッジ日時 | 2026-04-02 20:15:53 |
| 合計ジャッジ時間 | 2,075 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/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
はむ吉🐹