結果
| 問題 | No.1534 おなかがいたい |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-10-15 01:42:07 |
| 言語 | Haskell (9.14.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 22 ms / 2,000 ms |
| + 449µs | |
| コード長 | 940 bytes |
| 記録 | |
| コンパイル時間 | 6,150 ms |
| コンパイル使用メモリ | 197,760 KB |
| 実行使用メモリ | 18,816 KB |
| 最終ジャッジ日時 | 2026-10-15 01:42:25 |
| 合計ジャッジ時間 | 8,360 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-top-binds #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}
import Control.Monad
import Control.Monad.State.Strict
import Control.Applicative
import Data.Bool
import Data.Function
import Data.List
import Data.Ord
import Data.List.Split
-- import System.IO (hFlush, stdout)
import Debug.Trace
input = getLine :: IO String
ii = readLn :: IO Int
li = map read . words <$> getLine :: IO [Int]
printYn b = putStrLn $ bool "No" "Yes" b
pairwise :: [a] -> [(a, a)]
pairwise xs = zip xs (drop 1 xs)
countIf f = length . filter f
minmax (x:xs)
= foldl' (\(mi, ma) x -> (min mi x, max ma x)) (x, x) xs
solve ('p':'a':'i':'n':xs) k = max (k-1) (solve xs 0)
solve ('p':'o':'n':xs) k = solve xs (k+1)
solve (_:xs) k = solve xs k
solve [] _ = 0
main :: IO ()
main = do
s <- input
let ans = solve s 0
print $ if ans == 0 then -1 else ans
norioc