結果

問題 No.29 パワーアップ
ユーザー 情報学生情報学生
提出日時 2019-08-16 15:52:59
言語 Haskell
(9.8.2)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 370 bytes
コンパイル時間 2,768 ms
コンパイル使用メモリ 167,216 KB
実行使用メモリ 6,492 KB
最終ジャッジ日時 2023-10-22 06:32:07
合計ジャッジ時間 3,750 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,292 KB
testcase_01 AC 3 ms
5,264 KB
testcase_02 AC 3 ms
5,268 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,268 KB
testcase_05 AC 3 ms
6,244 KB
testcase_06 AC 3 ms
6,032 KB
testcase_07 AC 2 ms
5,636 KB
testcase_08 AC 2 ms
5,436 KB
testcase_09 AC 3 ms
5,296 KB
testcase_10 AC 4 ms
6,412 KB
testcase_11 AC 4 ms
6,492 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 3 ms
5,868 KB
testcase_14 AC 3 ms
6,248 KB
testcase_15 AC 3 ms
6,116 KB
testcase_16 AC 4 ms
5,976 KB
testcase_17 AC 3 ms
5,436 KB
testcase_18 AC 3 ms
5,752 KB
testcase_19 AC 3 ms
5,768 KB
testcase_20 AC 2 ms
5,280 KB
testcase_21 AC 2 ms
5,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List (sort, group)

main :: IO ()
main = interact $ show . solve . map read . tail . words

solve :: [Int] -> Int
solve xs = item2pair + item4pair
    where
        item2pair = sum ys
        item4pair = (sum zs) `div` 4
        ys = map (flip div 2) $ filter (>= 2) $ map length $ group $ sort xs
        zs = map (flip mod 2) $ map length $ group $ sort xs
0