結果

問題 No.806 木を道に
ユーザー iwotiwot
提出日時 2020-05-20 17:26:15
言語 Haskell
(9.8.2)
結果
AC  
実行時間 841 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 1,511 ms
コンパイル使用メモリ 171,904 KB
実行使用メモリ 85,632 KB
最終ジャッジ日時 2024-04-09 23:03:09
合計ジャッジ時間 11,463 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 150 ms
25,344 KB
testcase_11 AC 134 ms
23,168 KB
testcase_12 AC 694 ms
70,400 KB
testcase_13 AC 483 ms
57,984 KB
testcase_14 AC 641 ms
68,352 KB
testcase_15 AC 708 ms
71,296 KB
testcase_16 AC 217 ms
31,488 KB
testcase_17 AC 591 ms
65,280 KB
testcase_18 AC 51 ms
13,952 KB
testcase_19 AC 163 ms
26,240 KB
testcase_20 AC 605 ms
64,128 KB
testcase_21 AC 318 ms
37,504 KB
testcase_22 AC 827 ms
85,632 KB
testcase_23 AC 841 ms
85,632 KB
testcase_24 AC 260 ms
49,792 KB
testcase_25 AC 395 ms
67,328 KB
testcase_26 AC 176 ms
30,336 KB
testcase_27 AC 643 ms
84,608 KB
testcase_28 AC 15 ms
9,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

import Control.Monad
import Data.List

main = do
    n <- (read :: String -> Int) <$> getLine
    s <- replicateM (n-1) ((map read :: [String] -> [Int]) . words <$> getLine)
    print (solve s)

solve :: [[Int]] -> Int
solve xs =
    foldl (\n v -> (max (length v - 2) 0) + n) 0 (group $ sort $ concat xs)
0