結果
| 問題 | No.79 過小評価ダメ・ゼッタイ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-05 14:47:12 |
| 言語 | Haskell (9.14.1) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 5,000 ms |
| コード長 | 650 bytes |
| 記録 | |
| コンパイル時間 | 7,686 ms |
| コンパイル使用メモリ | 226,816 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2026-03-13 00:17:34 |
| 合計ジャッジ時間 | 5,937 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/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')