Submission #213314


Source Code Expand

Copy
{-# LANGUAGE BangPatterns        #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies        #-}

import           Control.Applicative
import           Control.Arrow
import           Control.Monad
import           Data.Array.IO
import           Data.Array.Unboxed
import           Data.Bool
import qualified Data.ByteString.Char8       as C
import           Data.Char
import           Data.Function
import           Data.Functor
import           Data.Int
import qualified Data.IntMap                 as IM
import           Data.IORef
import           Data.List
import qualified Data.Map                    as M
import           Data.Maybe
import           Data.Monoid
import           Data.Ord
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as S
import           Data.Tuple
import           Data.Word
import           Debug.Trace
import           System.IO
import           Text.Printf                 (printf)

import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM

-- I/O

readInts :: C.ByteString -> [Int]
readInts = map fst . mapMaybe C.readInt . C.words

getInts :: IO [Int]
getInts = readInts <$> C.getLine

readNums :: Num a => C.ByteString -> [a]
readNums = map (fromIntegral . fst) . mapMaybe C.readInteger . C.words

getNums :: Num a => IO [a]
getNums = readNums <$> C.getLine

cast :: (Integral a, Num b) => a -> b
cast = fromIntegral
{-# INLINE cast #-}

rep :: Int -> Int -> (Int -> IO ()) -> IO ()
rep i j m = go i where
  go !i
    | i < j = m i >> go (i+1)
    | otherwise = return ()
{-# INLINE rep #-}

rrep :: Int -> Int -> (Int -> IO ()) -> IO ()
rrep i j m = go i where
  go !i
    | i > j = m (i-1) >> go (i-1)
    | otherwise = return ()
{-# INLINE rrep #-}

-----

main :: IO ()
main = do
  [c] <- getLine
  print $ fromEnum c - fromEnum 'A' + 1

Submission Info

Submission Time
Task A - A
User tanakh
Language Haskell (GHC 7.4.1)
Score 100
Code Size 2106 Byte
Status AC
Exec Time 33 ms
Memory 1308 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 5
Set Name Test Cases
all A.txt, B.txt, C.txt, D.txt, E.txt
Case Name Status Exec Time Memory
A.txt AC 32 ms 1304 KB
B.txt AC 29 ms 1308 KB
C.txt AC 31 ms 1308 KB
D.txt AC 32 ms 1308 KB
E.txt AC 33 ms 1308 KB