結果
問題 | No.90 品物の並び替え |
ユーザー |
![]() |
提出日時 | 2017-04-15 11:22:11 |
言語 | Haskell (9.10.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 744 bytes |
コンパイル時間 | 236 ms |
コンパイル使用メモリ | 147,584 KB |
最終ジャッジ日時 | 2024-11-14 19:59:50 |
合計ジャッジ時間 | 636 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) Main.hs:20:31: error: [GHC-58481] parse error on input ‘<-’ Suggested fix: Possibly caused by a missing 'do'? | 20 | [item1, item2, score] <- map read . words <$> table | ^^
ソースコード
importControl.MonadreplicateMimportData.ListelemIndex,permutationssolve::Integrala=>a->aaa->asolve n table = maximum $ doitems <- permutations [0..n - 1]return $ calc items table wherecalc::Integrala=>a->aaa->acalc items' table' = sum $ do(item1, item2, score) <- table'return $ case (compare <$> elemIndex item1 <*> elemIndex item2) items' ofLT -> scoreGT -> 0main::IO()main = do[n, m] <- map read . words <$> getLinetable <- replicateM m getLinelet table' = do[item1, item2, score] <- map read . words <$> tablereturn (item1, item2, score)print $ solve n table'