結果

問題 No.112 ややこしい鶴亀算
ユーザー はむ吉🐹はむ吉🐹
提出日時 2015-10-24 11:33:32
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 366 bytes
コンパイル時間 2,303 ms
コンパイル使用メモリ 162,340 KB
実行使用メモリ 7,696 KB
最終ジャッジ日時 2023-10-11 05:35:57
合計ジャッジ時間 2,312 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,140 KB
testcase_01 AC 2 ms
7,008 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 3 ms
6,976 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
7,112 KB
testcase_07 WA -
testcase_08 AC 3 ms
6,964 KB
testcase_09 AC 2 ms
7,004 KB
testcase_10 AC 2 ms
7,232 KB
testcase_11 AC 2 ms
7,228 KB
testcase_12 WA -
testcase_13 AC 2 ms
7,156 KB
testcase_14 AC 3 ms
7,272 KB
testcase_15 AC 3 ms
7,476 KB
testcase_16 AC 3 ms
7,488 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 3 ms
7,348 KB
testcase_20 AC 3 ms
7,288 KB
testcase_21 AC 3 ms
7,452 KB
testcase_22 AC 3 ms
7,492 KB
testcase_23 WA -
testcase_24 AC 2 ms
7,276 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 Data.List (sort, group)

calc :: [Int] -> [Int]
calc xs
    | all (== h) xs = if l == 2 then [s, 0] else [0, s]
    | otherwise     = reverse $ sort $ map length $ group $ sort xs
    where
        h = head xs
        s = length xs
        l = div h $ s - 1

main :: IO ()
main = getLine >> getLine >>= putStrLn . unwords . map show . calc . map read . words
0