結果
問題 |
No.90 品物の並び替え
|
ユーザー |
![]() |
提出日時 | 2015-10-26 22:59:47 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 898 ms / 5,000 ms |
コード長 | 696 bytes |
コンパイル時間 | 12,312 ms |
コンパイル使用メモリ | 210,732 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2024-09-13 03:32:18 |
合計ジャッジ時間 | 14,274 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
コンパイルメッセージ
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 Data.List (permutations) import Control.Applicative ((<$>)) import Data.Maybe (fromJust) import qualified Data.Vector.Unboxed as V import qualified Data.ByteString.Lazy.Char8 as B judge :: V.Vector Int -> V.Vector Int -> Int judge is t | V.elemIndex i1 is < V.elemIndex i2 is = s | otherwise = 0 where i1 = (V.!) t 0 i2 = (V.!) t 1 s = (V.!) t 2 main :: IO () main = do [n, _] <- map read . words <$> getLine ts <- map V.fromList . map (map (fst . fromJust . B.readInt)) . map B.words . B.lines <$> B.getContents print $ maximum $ map (\p -> sum $ map (judge p) ts) $ map V.fromList $ permutations [0 .. n - 1]