結果
| 問題 |
No.79 過小評価ダメ・ゼッタイ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-05 14:47:12 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 5,000 ms |
| コード長 | 650 bytes |
| コンパイル時間 | 5,953 ms |
| コンパイル使用メモリ | 209,416 KB |
| 実行使用メモリ | 8,320 KB |
| 最終ジャッジ日時 | 2024-06-26 08:22:25 |
| 合計ジャッジ時間 | 6,902 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
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
ソースコード
import Control.Applicative ((<$>))
import Data.List
import Data.Char (isSpace)
import qualified Data.ByteString.Char8 as B8
import Data.Vector.Unboxed (Vector)
import qualified Data.Vector.Unboxed as VU
main :: IO ()
main = do
B8.getLine
solve <$> readIntList >>= print
solve :: [Int] -> Int
solve = VU.last . g . foldl' f (VU.replicate 7 0)
where
f :: Vector Int -> Int -> Vector Int
f v x = VU.accum (+) v [(x, 1)]
g v = let mx = VU.maximum v in VU.findIndices (== mx) v
readIntList :: IO [Int]
readIntList = unfoldr f <$> B8.getLine
where
f s = do
(n, s') <- B8.readInt s
return (n, B8.dropWhile isSpace s')