結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー |
![]() |
提出日時 | 2016-12-23 19:49:19 |
言語 | Haskell (9.10.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,564 bytes |
コンパイル時間 | 519 ms |
コンパイル使用メモリ | 147,968 KB |
最終ジャッジ日時 | 2024-12-14 17:02:32 |
合計ジャッジ時間 | 1,679 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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:10:1: error: [GHC-87110] Could not load module ‘Data.Map’. It is a member of the hidden package ‘containers-0.6.8’. Use -v to see a list of the files searched for. | 10 | import qualified Data.Map as M | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
importControl.Applicative(<$>)importControl.ArrowsecondimportControl.MonadimportControl.Monad.StateimportData.CharordimportData.ListelemIndices,sortByimportData.FunctiononimportData.Monoid(<>)importqualifiedData.ArrayasAimportqualifiedData.MapasMtype Submission = (String, Int)type AcCnt = M.Map Int Intmain::IO()main = don <- readLnls <- map read . words <$> getLinet <- readLnsubs <- replicateM t $ do[name, p] <- words <$> getLinereturn (name, ord (head p)-ord 'A')let upds = map (second A.elems) $ M.toList $ evalState (proc subs ls n) $ M.fromList $ zip [0..n-1] $ repeat 1forM_ (zip [1..] (sortBy (comp subs) upds)) $ \(i, (name, xs)) -> doputStr $ show i ++ " " ++ namemapM_ (putStr . (" "++) . show) xsputStrLn $ " " ++ show (sum xs)proc::Submission->Double->Int->StateAcCntMMapStringAArrayIntIntproc [] _ _ = return M.emptyproc ((name, p):xs) ls n = doacCnt <- getlet pts = evalState (proc xs ls n) (M.insert p (acCnt M.! p+1) acCnt)pts' = if name `M.notMember` pts then M.insert name (A.listArray (0, n-1) $ repeat 0) pts else ptsreturn $ M.insert name (pts' M.! name A.// [(p, floor $ 50*(ls!!p)+50*(ls!!p)/(0.8+0.2*fromIntegral (acCnt M.! p)))]) pts'comp::Submission->StringInt->StringInt->Orderingcomp subs (lName, l) (rName, r) = (compare `on` sum) r l <> idxL `compare` idxRwhereidxL = last $ elemIndices lName $ map fst subsidxR = last $ elemIndices rName $ map fst subs