Submission #33872


Source Code Expand

Copy
import Control.Applicative
import qualified Data.ByteString.Char8 as B8
import qualified Data.Vector as V
import Data.Maybe

main :: IO ()
main = do
  [n,l] <- map read . words <$> getLine
  xs <- V.replicateM l $ B8.getLine
  y <- fromJust . B8.elemIndex 'o' <$> B8.getLine

  let snake (-1) yy = yy `div` 2 + 1
      snake ll yy
        | yy < (n - 1) * 2 && B8.index x (yy + 1) == '-' = snake ll' (yy + 2)
        | yy > 0 && B8.index x (yy - 1) == '-' = snake ll' (yy - 2)
        | otherwise = snake ll' yy
        where ll' = pred ll
              x = xs V.! ll
  print $ snake (pred l) y

Submission Info

Submission Time
Task B - あみだくじ
User seagull_kamome
Language Haskell (GHC 7.4.1)
Score 100
Code Size 616 Byte
Status AC
Exec Time 98 ms
Memory 1452 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 34
Set Name Test Cases
All 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_maxrnd_00.txt, 02_maxrnd_01.txt, 02_maxrnd_02.txt, 02_maxrnd_03.txt, 02_maxrnd_04.txt, 03_empty_00.txt, 03_empty_01.txt, 03_empty_02.txt
Case Name Status Exec Time Memory
00_min.txt AC 98 ms 1324 KB
00_sample_01.txt AC 25 ms 1304 KB
00_sample_02.txt AC 25 ms 1372 KB
00_sample_03.txt AC 24 ms 1424 KB
00_sample_04.txt AC 25 ms 1336 KB
00_sample_05.txt AC 26 ms 1268 KB
01_rnd_00.txt AC 36 ms 1452 KB
01_rnd_01.txt AC 25 ms 1360 KB
01_rnd_02.txt AC 24 ms 1272 KB
01_rnd_03.txt AC 25 ms 1336 KB
01_rnd_04.txt AC 27 ms 1280 KB
01_rnd_05.txt AC 25 ms 1336 KB
01_rnd_06.txt AC 25 ms 1340 KB
01_rnd_07.txt AC 26 ms 1432 KB
01_rnd_08.txt AC 26 ms 1420 KB
01_rnd_09.txt AC 25 ms 1332 KB
01_rnd_10.txt AC 25 ms 1356 KB
01_rnd_11.txt AC 25 ms 1268 KB
01_rnd_12.txt AC 25 ms 1236 KB
01_rnd_13.txt AC 25 ms 1336 KB
01_rnd_14.txt AC 25 ms 1432 KB
01_rnd_15.txt AC 25 ms 1424 KB
01_rnd_16.txt AC 27 ms 1404 KB
01_rnd_17.txt AC 26 ms 1428 KB
01_rnd_18.txt AC 25 ms 1336 KB
01_rnd_19.txt AC 25 ms 1340 KB
02_maxrnd_00.txt AC 25 ms 1428 KB
02_maxrnd_01.txt AC 25 ms 1360 KB
02_maxrnd_02.txt AC 26 ms 1336 KB
02_maxrnd_03.txt AC 25 ms 1336 KB
02_maxrnd_04.txt AC 25 ms 1340 KB
03_empty_00.txt AC 23 ms 1336 KB
03_empty_01.txt AC 24 ms 1344 KB
03_empty_02.txt AC 25 ms 1268 KB