結果
| 問題 |
No.1738 What's in the box?
|
| コンテスト | |
| ユーザー |
sanao10000
|
| 提出日時 | 2021-11-13 00:02:09 |
| 言語 | Haskell (9.10.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 3,513 bytes |
| コンパイル時間 | 5,397 ms |
| コンパイル使用メモリ | 152,448 KB |
| 最終ジャッジ日時 | 2024-11-25 23:25:31 |
| 合計ジャッジ時間 | 5,901 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:23:1: error: [GHC-87110]
Could not load module ‘Data.Set’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
23 | import qualified Data.Set as Set
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Main.hs:24:1: error: [GHC-87110]
Could not load module ‘Data.Map.Strict’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
24 | import qualified Data.Map.Strict as Map
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Main.hs:25:1: error: [GHC-87110]
Could not load module ‘Data.Sequence’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
25 | import qualified Data.Sequence as Seq
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Main.hs:27:1: error: [GHC-87110]
Could not load module ‘Data.Graph’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
27 | import Data.Graph
| ^^^^^^^^^^^^^^^^^
ソースコード
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Applicative
import Control.Monad.State
import qualified Numeric as Nu
import qualified Control.Monad as CM
import qualified Data.List as L
import qualified Control.Monad.ST as ST
import qualified Data.ByteString.Char8 as BS
import qualified Data.Array as A
import qualified Data.Array.IO as AI
import qualified Data.Char as Ch
import qualified Data.Text as T
import qualified Data.IORef as IO
import qualified Data.Text.IO as T
import qualified Data.Array.ST as AST
import qualified Data.ByteString.Builder as BB
import qualified Data.Set as Set
import qualified Data.Map.Strict as Map
import qualified Data.Sequence as Seq
import qualified Data.Maybe as May
import Data.Graph
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import Prelude hiding (print)
main = do
[n,m] <- cin @[Int]
hs<-V.fromList<$>cin @[Int]
let a= V.sum hs
aa<-VM.replicate n (0::Int)
b<-V.thaw hs
CM.forM_ (V.fromList[0..n-1]) $ \i->do
VM.modify b (\x->x*m) i
v<-(VM.read b i)
VM.write aa i(div(v)a)
c<-V.freeze aa
putStr $ if a==0 then unwords(map show(take n(repeat 0))) else unwords(map show(V.toList c))
type Moji= BS.ByteString
buildUndirected :: [(Int,Int)] -> [(Int,Int)]
buildUndirected x= Set.toList$Set.fromList $ concatMap (\ (a, b) -> [(a, b), (b, a)]) x
print :: Show a => a -> IO ()
print x=BS.putStrLn $ BS.pack $ show x
class Sanao a where
sanao :: Moji -> a
{-# MINIMAL sanao #-}
instance Sanao Moji where
sanao= id
instance Sanao Int where
sanao x= case BS.readInt x of
Nothing -> error "ここはInt"
Just (a,_) -> a
instance Sanao Double where
sanao x= case BS.readInt x of
Nothing -> error "ここはDouble"
Just (a,_) -> realToFrac a
instance Sanao [Moji] where
sanao=BS.words
instance (Sanao a)=>Sanao [a] where
sanao= map sanao.BS.words
instance Sanao(Int,Int) where
sanao= (\[a, b]->(a, b)) . map sanao . BS.words
instance Sanao(Int, Int, Int) where
sanao= (\[a, b, c]->(a, b, c)) . map sanao . BS.words
instance Sanao(Int, Int, Int, Int) where
sanao= (\[a, b, c, d]->(a, b, c, d)) . map sanao . BS.words
instance Sanao(Double,Double) where
sanao= (\[a, b]->(a, b)) . map sanao . BS.words
instance Sanao(Double,Double, Double) where
sanao= (\[a, b, c]->(a, b, c)) . map sanao . BS.words
instance Sanao(Double,Double, Double, Double) where
sanao= (\[a, b, c, d]->(a, b, c, d)) . map sanao . BS.words
instance Sanao(Moji,Int) where
sanao= (\[a, b]->(a,sanao b)) . BS.words
instance Sanao(Moji,Int, Int) where
sanao= (\[a, b, c]->(a,sanao b, sanao c)) . BS.words
instance Sanao(Int,Moji) where
sanao= (\[a, b]->(sanao a,b)) . BS.words
instance Sanao(Moji,Double) where
sanao= (\[a, b]->(a,sanao b)) . BS.words
cin::Sanao a=>IO a
cin=sanao<$>BS.getLine
instance Sanao(Double,Moji) where
sanao= (\[a, b]->(sanao a,b)) . BS.words
sanao10000