結果
問題 | No.92 逃走経路 |
ユーザー | aimy |
提出日時 | 2017-04-21 19:30:42 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 803 ms / 5,000 ms |
コード長 | 937 bytes |
コンパイル時間 | 1,720 ms |
コンパイル使用メモリ | 161,924 KB |
実行使用メモリ | 13,060 KB |
最終ジャッジ日時 | 2023-09-27 11:02:40 |
合計ジャッジ時間 | 6,700 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 432 ms
13,056 KB |
testcase_01 | AC | 3 ms
7,576 KB |
testcase_02 | AC | 2 ms
7,508 KB |
testcase_03 | AC | 2 ms
7,428 KB |
testcase_04 | AC | 2 ms
7,504 KB |
testcase_05 | AC | 72 ms
12,160 KB |
testcase_06 | AC | 42 ms
12,592 KB |
testcase_07 | AC | 43 ms
12,532 KB |
testcase_08 | AC | 7 ms
11,772 KB |
testcase_09 | AC | 62 ms
11,816 KB |
testcase_10 | AC | 452 ms
12,140 KB |
testcase_11 | AC | 482 ms
12,148 KB |
testcase_12 | AC | 803 ms
12,284 KB |
testcase_13 | AC | 32 ms
12,072 KB |
testcase_14 | AC | 73 ms
12,156 KB |
testcase_15 | AC | 162 ms
12,264 KB |
testcase_16 | AC | 182 ms
12,540 KB |
testcase_17 | AC | 392 ms
13,028 KB |
testcase_18 | AC | 242 ms
12,996 KB |
testcase_19 | AC | 143 ms
13,060 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
ソースコード
import Control.Monad import Data.List import qualified Data.Set as S type YukiCity = ([City],[Road]) cities = fst roads = snd next rs c t = map (from c . fst) $ filter (\r -> link c (path r) && toll r == t) rs type Road = (Path,Toll) path = fst toll = snd type Path = (City,City) link c (c1,c2) = c==c1 || c==c2 from c (c1,c2) | c == c1 = c2 | c == c2 = c1 type Info = [Toll] type City = Int type Toll = Int nub' = S.toList . S.fromList main = do [n,m,k] <- map read . words <$> getLine abcs <- map (map read . words) <$> replicateM m getLine info <- map read . words <$> getLine let rs = map (\[a,b,c] -> ((a,b),c)) abcs let result = investigate ([1..n],rs) info print (length result) putStrLn (unwords (map show result)) investigate :: YukiCity -> Info -> [City] investigate yc i = foldl' (move (roads yc)) (cities yc) i move :: [Road] -> [City] -> Toll -> [City] move rs cs t = nub' $ concatMap (\c -> next rs c t) cs