Submission #1074516
Source Code Expand
module Main where import Control.Applicative import Control.Monad import Control.Monad.State import Data.Array import Data.Graph import qualified Data.ByteString.Lazy.Char8 as L type Tokenizer = State [L.ByteString] nextInt :: Tokenizer Int nextInt = state $ \(s:ss) -> case L.readInt s of Just (x, _) -> (x, ss) Nothing -> error $ "Can't parse Int: " ++ (L.unpack s) maxDepth :: Graph -> Vertex -> Int maxDepth g u | null ds = 0 | otherwise = minimum ds + length ds where ds = map (maxDepth g) (g ! u) go :: Tokenizer Int go = do n <- nextInt ss <- replicateM (n - 1) nextInt let ts = [2 .. n] graph = buildG (1, n) (zip ss ts) return $ maxDepth graph 1 main :: IO () main = do contents <- L.words <$> L.getContents let depth = evalState go contents print depth
Submission Info
Submission Time | |
---|---|
Task | B - Tournament |
User | ygorshenin |
Language | Haskell (GHC 7.10.3) |
Score | 0 |
Code Size | 904 Byte |
Status | WA |
Exec Time | 109 ms |
Memory | 15228 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 800 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 106 ms | 7036 KB |
02.txt | WA | 106 ms | 7036 KB |
03.txt | WA | 105 ms | 7036 KB |
04.txt | WA | 107 ms | 7036 KB |
05.txt | WA | 106 ms | 7420 KB |
06.txt | WA | 106 ms | 7036 KB |
07.txt | WA | 109 ms | 7036 KB |
08.txt | WA | 107 ms | 7036 KB |
09.txt | WA | 105 ms | 7036 KB |
10.txt | WA | 106 ms | 7036 KB |
11.txt | AC | 65 ms | 14972 KB |
12.txt | WA | 76 ms | 15228 KB |
13.txt | WA | 73 ms | 13820 KB |
14.txt | WA | 70 ms | 13564 KB |
15.txt | WA | 66 ms | 13308 KB |
16.txt | WA | 63 ms | 12924 KB |
17.txt | WA | 50 ms | 7420 KB |
18.txt | WA | 49 ms | 7420 KB |
19.txt | WA | 51 ms | 7420 KB |
20.txt | AC | 51 ms | 7164 KB |
21.txt | AC | 53 ms | 13052 KB |
22.txt | WA | 53 ms | 13052 KB |
23.txt | WA | 53 ms | 13180 KB |
24.txt | WA | 54 ms | 13564 KB |
25.txt | WA | 55 ms | 13820 KB |
26.txt | WA | 56 ms | 13564 KB |
27.txt | WA | 54 ms | 12668 KB |
28.txt | WA | 45 ms | 7420 KB |
29.txt | WA | 46 ms | 7420 KB |
30.txt | WA | 47 ms | 7420 KB |
31.txt | WA | 42 ms | 7420 KB |
32.txt | WA | 42 ms | 7036 KB |
33.txt | AC | 42 ms | 7420 KB |
34.txt | WA | 41 ms | 7420 KB |
35.txt | AC | 41 ms | 7420 KB |
36.txt | AC | 41 ms | 7420 KB |
37.txt | WA | 41 ms | 7420 KB |
38.txt | WA | 40 ms | 7164 KB |
39.txt | WA | 42 ms | 7164 KB |
40.txt | WA | 40 ms | 7420 KB |
41.txt | AC | 3 ms | 380 KB |
42.txt | AC | 3 ms | 380 KB |
43.txt | AC | 3 ms | 380 KB |
44.txt | AC | 3 ms | 380 KB |
45.txt | WA | 3 ms | 380 KB |
46.txt | AC | 3 ms | 380 KB |
47.txt | AC | 3 ms | 380 KB |
48.txt | AC | 3 ms | 380 KB |
49.txt | WA | 3 ms | 380 KB |
50.txt | AC | 3 ms | 380 KB |
s1.txt | WA | 3 ms | 380 KB |
s2.txt | AC | 3 ms | 380 KB |
s3.txt | AC | 3 ms | 380 KB |