結果
問題 | No.90 品物の並び替え |
ユーザー | はむ吉🐹 |
提出日時 | 2015-10-26 22:34:35 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 2,992 ms / 5,000 ms |
コード長 | 547 bytes |
コンパイル時間 | 7,871 ms |
コンパイル使用メモリ | 163,768 KB |
実行使用メモリ | 12,740 KB |
最終ジャッジ日時 | 2023-10-01 03:08:33 |
合計ジャッジ時間 | 12,973 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,548 KB |
testcase_01 | AC | 202 ms
12,660 KB |
testcase_02 | AC | 3 ms
7,416 KB |
testcase_03 | AC | 23 ms
11,740 KB |
testcase_04 | AC | 32 ms
11,676 KB |
testcase_05 | AC | 232 ms
12,740 KB |
testcase_06 | AC | 162 ms
12,644 KB |
testcase_07 | AC | 7 ms
11,152 KB |
testcase_08 | AC | 3 ms
7,496 KB |
testcase_09 | AC | 2,992 ms
12,736 KB |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Data.List (permutations, elemIndex) import Control.Applicative ((<$>)) import qualified Data.ByteString.Lazy.Char8 as B import Data.Maybe (fromJust) judge :: [Int] -> [Int] -> Int judge is (i1 : i2 : s : _) | elemIndex i1 is < elemIndex i2 is = s | otherwise = 0 main :: IO () main = do [n, _] <- map read . words <$> getLine ts <- map (map (fst . fromJust . B.readInt)) . map B.words . B.lines <$> B.getContents print $ maximum $ map (\p -> sum $ map (judge p) ts) $ permutations [0 .. n - 1]