結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-08-21 16:50:26 |
| 言語 | Haskell (9.10.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 579 bytes |
| コンパイル時間 | 1,144 ms |
| コンパイル使用メモリ | 149,888 KB |
| 最終ジャッジ日時 | 2024-06-11 06:54:35 |
| 合計ジャッジ時間 | 1,501 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:3:1: error: [GHC-87110]
Could not load module ‘Data.IntSet’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
3 | import qualified Data.IntSet as IS
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
import Control.Applicative ((<$>))
import qualified Data.ByteString.Lazy.Char8 as LC
import qualified Data.IntSet as IS
import Data.Maybe (fromJust)
unsafeReadInt :: LC.ByteString -> Int
unsafeReadInt = fst . fromJust . LC.readInt
diff :: Num a => [a] -> [a]
diff xs = zipWith (-) (tail xs) (init xs)
findMin :: [Int] -> Int
findMin xs
| IS.size ys < 2 = 0
| otherwise = minimum . diff . IS.toAscList $ ys
where
ys = IS.fromList xs
main :: IO ()
main = do
_ <- getLine
xs <- fmap unsafeReadInt . LC.words <$> LC.getContents
print $ findMin xs
はむ吉🐹