結果

問題 No.90 品物の並び替え
ユーザー hoghehoghe
提出日時 2020-01-10 12:01:55
言語 Haskell
(9.8.2)
結果
AC  
実行時間 3,142 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 7,173 ms
コンパイル使用メモリ 167,248 KB
実行使用メモリ 23,144 KB
最終ジャッジ日時 2023-08-15 14:21:12
合計ジャッジ時間 11,906 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,388 KB
testcase_01 AC 213 ms
12,608 KB
testcase_02 AC 3 ms
7,160 KB
testcase_03 AC 22 ms
11,372 KB
testcase_04 AC 32 ms
11,504 KB
testcase_05 AC 252 ms
12,580 KB
testcase_06 AC 172 ms
12,672 KB
testcase_07 AC 8 ms
11,204 KB
testcase_08 AC 2 ms
7,232 KB
testcase_09 AC 3,142 ms
23,144 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

ソースコード

diff #

import Control.Monad (replicateM)
import Data.List     (permutations)

getPoint l (x:y:zs)
    | filter (\a -> x==a||y==a) l == [x,y] = head zs
    | otherwise                            = 0

main = do
    n:m:_     <- map read <$> words <$> getLine
    pointList <- replicateM m (map read <$> words <$> getLine)
    let lines   = permutations [0..(n-1)]
        results = map sum
            $ zipWith map (zipWith id (repeat getPoint) lines)
            $ repeat pointList
    print $ foldr max 0 results
0