結果

問題 No.482 あなたの名は
ユーザー くれちーくれちー
提出日時 2017-02-10 23:18:46
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 8,310 ms
コンパイル使用メモリ 161,940 KB
実行使用メモリ 11,260 KB
最終ジャッジ日時 2023-08-28 08:53:24
合計ジャッジ時間 13,992 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,064 KB
testcase_01 AC 3 ms
7,020 KB
testcase_02 AC 2 ms
6,884 KB
testcase_03 AC 2 ms
6,980 KB
testcase_04 AC 2 ms
7,056 KB
testcase_05 WA -
testcase_06 AC 3 ms
7,060 KB
testcase_07 WA -
testcase_08 AC 12 ms
9,820 KB
testcase_09 AC 3 ms
7,780 KB
testcase_10 AC 12 ms
9,792 KB
testcase_11 AC 12 ms
10,632 KB
testcase_12 AC 22 ms
11,244 KB
testcase_13 WA -
testcase_14 AC 6 ms
9,424 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Data.List
import Control.Applicative

swap :: (a, b) -> (b, a)
swap (x, y) = (y, x)

eq :: Eq a => (a, a) -> (a, a) -> Bool
eq x y = x == y || swap x == y

solve :: Integral a => a -> a -> [a] -> String
solve n k ds
    | t2 < 0          = "NO"
    | t2 `mod` 2 == 0 = "YES"
    | otherwise       = "NO"
    where
        t1 = length $ filter (\(x, y) -> x /= y) $ nubBy eq $ zip ds [1..]
        t2 = k - fromIntegral t1

main = do
    [n, k] <- map read . words <$> getLine
    ds <- map read . words <$> getLine
    putStrLn $ solve n k ds
0