結果

問題 No.239 にゃんぱすー
ユーザー ducktailducktail
提出日時 2018-01-09 22:47:06
言語 Haskell
(9.8.2)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 1,512 ms
コンパイル使用メモリ 164,444 KB
実行使用メモリ 10,688 KB
最終ジャッジ日時 2023-08-25 02:27:28
合計ジャッジ時間 3,830 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,124 KB
testcase_01 AC 3 ms
7,176 KB
testcase_02 AC 2 ms
7,176 KB
testcase_03 AC 2 ms
7,136 KB
testcase_04 AC 2 ms
7,144 KB
testcase_05 AC 3 ms
7,076 KB
testcase_06 AC 2 ms
7,180 KB
testcase_07 AC 3 ms
7,084 KB
testcase_08 AC 3 ms
7,216 KB
testcase_09 AC 3 ms
7,420 KB
testcase_10 AC 3 ms
7,388 KB
testcase_11 AC 3 ms
7,560 KB
testcase_12 AC 3 ms
7,504 KB
testcase_13 AC 3 ms
7,676 KB
testcase_14 AC 3 ms
7,884 KB
testcase_15 AC 3 ms
7,960 KB
testcase_16 AC 3 ms
8,052 KB
testcase_17 AC 3 ms
8,312 KB
testcase_18 AC 4 ms
8,500 KB
testcase_19 AC 4 ms
8,772 KB
testcase_20 AC 4 ms
8,980 KB
testcase_21 AC 4 ms
9,192 KB
testcase_22 AC 4 ms
9,560 KB
testcase_23 AC 5 ms
9,700 KB
testcase_24 AC 6 ms
10,052 KB
testcase_25 AC 6 ms
10,452 KB
testcase_26 AC 6 ms
10,688 KB
testcase_27 AC 3 ms
7,260 KB
testcase_28 AC 3 ms
7,368 KB
testcase_29 AC 3 ms
7,552 KB
testcase_30 AC 3 ms
7,812 KB
testcase_31 AC 3 ms
8,260 KB
testcase_32 AC 4 ms
8,476 KB
testcase_33 AC 4 ms
8,972 KB
testcase_34 AC 5 ms
9,436 KB
testcase_35 AC 6 ms
10,048 KB
testcase_36 AC 6 ms
10,656 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative ((<$>))
import Control.Monad
import Data.List
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = do
  n <- readLn
  solve <$> replicateM n getss >>= print

solve :: [[ByteString]] -> Int
solve xss = g . filter (/= 0) . map f $ zip [1..] (transpose xss)
  where
    s1 = B.pack "nyanpass"
    s2 = B.pack "-"
    f :: (Int, [ByteString]) -> Int
    f (i, ys) = if all (\y -> y == s1 || y == s2) ys then i else 0
    g zs = if length zs == 1 then head zs else (-1)

getss :: IO [ByteString]
getss = B.words <$> B.getLine
0