結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2015-07-24 01:45:23 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 9,563 ms |
コンパイル使用メモリ | 180,388 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 21:00:06 |
合計ジャッジ時間 | 4,573 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
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
ソースコード
importControl.ApplicativeimportControl.MonadimportqualifiedData.ByteString.CharasBimportData.MaybefromJustimportText.PrintfimportDebug.TracereadInts::BByteString->IntreadInts = map (fst . fromJust . B.readInt) . B.wordsgetInts::IOIntgetInts = liftM readInts B.getLinedx = [-1,1,2,2,1,-1,-2,-2]dy = [-2,-2,-1,1,2,2,1,-1]dfs x y 0 = [(x,y)]dfs x y n = concat [(x',y'):(dfs x' y' (n-1))| (x',y') <- map (\i -> (x+dx!!i, y+dy!!i)) [0..7]]pr True = "YES"pr False = "NO"main = do[x,y] <- getIntsputStrLn $ pr $ (x,y) `elem` dfs 0 0 3