結果

問題 No.90 品物の並び替え
ユーザー aimyaimy
提出日時 2017-04-28 17:35:57
言語 Haskell
(9.8.2)
結果
AC  
実行時間 3,992 ms / 5,000 ms
コード長 363 bytes
コンパイル時間 2,709 ms
コンパイル使用メモリ 169,088 KB
実行使用メモリ 13,196 KB
最終ジャッジ日時 2023-10-11 18:59:41
合計ジャッジ時間 8,429 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,352 KB
testcase_01 AC 272 ms
12,504 KB
testcase_02 AC 2 ms
7,328 KB
testcase_03 AC 22 ms
11,328 KB
testcase_04 AC 32 ms
11,404 KB
testcase_05 AC 313 ms
12,444 KB
testcase_06 AC 213 ms
12,356 KB
testcase_07 AC 12 ms
10,672 KB
testcase_08 AC 3 ms
7,324 KB
testcase_09 AC 3,992 ms
13,196 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 Data.List

main = do
 [n,_] <- map read . words <$> getLine
 ijss <- map (map read . words) . lines <$> getContents
 print (vmax n (map (\[i,j,s]->((i,j),s)) ijss))

vmax n ijss = maximum $ map (score ijss) (permutations [0..n-1])

score ijss ns = foldr (\(_,s) acc -> s+acc) 0 (filter ok ijss)
 where ok ((i,j),_) = filter (\x -> x==i || x==j) ns == [i,j]
0