結果

問題 No.615 集合に分けよう
ユーザー momen999momen999
提出日時 2019-03-07 10:31:14
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 1,880 ms
コンパイル使用メモリ 164,456 KB
実行使用メモリ 40,168 KB
最終ジャッジ日時 2023-09-05 19:21:29
合計ジャッジ時間 7,192 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,240 KB
testcase_01 AC 2 ms
7,220 KB
testcase_02 AC 2 ms
6,972 KB
testcase_03 AC 2 ms
7,196 KB
testcase_04 AC 2 ms
7,260 KB
testcase_05 AC 3 ms
7,392 KB
testcase_06 AC 3 ms
7,376 KB
testcase_07 AC 3 ms
7,796 KB
testcase_08 AC 3 ms
7,800 KB
testcase_09 AC 3 ms
7,824 KB
testcase_10 AC 3 ms
7,616 KB
testcase_11 AC 3 ms
7,676 KB
testcase_12 AC 2 ms
7,136 KB
testcase_13 AC 7 ms
11,400 KB
testcase_14 AC 12 ms
11,548 KB
testcase_15 AC 63 ms
17,280 KB
testcase_16 AC 63 ms
37,996 KB
testcase_17 AC 343 ms
40,164 KB
testcase_18 AC 333 ms
40,064 KB
testcase_19 AC 343 ms
40,148 KB
testcase_20 AC 343 ms
40,124 KB
testcase_21 AC 323 ms
40,084 KB
testcase_22 AC 293 ms
40,168 KB
testcase_23 AC 173 ms
21,660 KB
testcase_24 AC 332 ms
39,040 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 82 ms
20,648 KB
testcase_28 AC 82 ms
20,732 KB
testcase_29 AC 212 ms
37,920 KB
testcase_30 AC 212 ms
37,820 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 Data.List

rInteger :: String -> Integer
rInteger = read

solve :: Int -> Int -> [Integer] -> Integer
solve 1 _ as = head as
solve n k as = foldr (+) 0 ts where
    ts = take (n - k) $ sort xs
    xs = zipWith (-) (reverse (tail as)) (reverse (init as))
main = do
    [n, k] <- map read . words <$> getLine
    as <- sort . map rInteger . words <$> getLine
    print $ solve n k as
0