結果

問題 No.791 うし数列
コンテスト
ユーザー 情報学生
提出日時 2019-09-15 18:19:17
言語 Haskell
(9.14.1)
コンパイル:
ghc -rtsopts -with-rtsopts=-K1G -o a.out -O2 _filename_
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 335 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 268 ms
コンパイル使用メモリ 164,096 KB
最終ジャッジ日時 2026-03-28 12:50:34
合計ジャッジ時間 814 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
Main.hs:1:1: error: [GHC-87110]
    Could not load module ‘Data.Set’.
    It is a member of the hidden package ‘containers-0.8’.
    Use -v to see a list of the files searched for.
  |
1 | import Data.Set (Set)
  | ^^^^^^^^^^^^^^^^^^^^^

Main.hs:2:1: error: [GHC-87110]
    Could not load module ‘Data.Set’.
    It is a member of the hidden package ‘containers-0.8’.
    Use -v to see a list of the files searched for.
  |
2 | import qualified Data.Set as S
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #
raw source code

import Data.Set (Set)
import qualified Data.Set as S

main :: IO ()
main = print =<< solve <$> getLine

isMow :: String -> Bool
isMow cs = ((S.size $ S.fromList cs) == 1) && (head cs == '3')

solve :: String -> Int
solve s | head s /= '1'        = -1
        | not $ isMow $ tail s = -1
        | otherwise            = length $ tail s
0