結果
問題 |
No.806 木を道に
|
ユーザー |
|
提出日時 | 2020-05-20 17:26:15 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 830 ms / 2,000 ms |
コード長 | 306 bytes |
コンパイル時間 | 1,857 ms |
コンパイル使用メモリ | 171,904 KB |
実行使用メモリ | 85,632 KB |
最終ジャッジ日時 | 2024-10-01 23:40:23 |
合計ジャッジ時間 | 11,365 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
コンパイルメッセージ
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 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)