結果

問題 No.45 回転寿司
ユーザー aimyaimy
提出日時 2017-04-26 09:23:37
言語 Haskell
(9.8.2)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 304 bytes
コンパイル時間 990 ms
コンパイル使用メモリ 168,228 KB
実行使用メモリ 11,764 KB
最終ジャッジ日時 2023-08-27 15:26:55
合計ジャッジ時間 2,466 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,664 KB
testcase_01 AC 5 ms
10,376 KB
testcase_02 AC 6 ms
11,352 KB
testcase_03 AC 5 ms
11,764 KB
testcase_04 AC 5 ms
10,508 KB
testcase_05 AC 2 ms
8,184 KB
testcase_06 AC 5 ms
9,920 KB
testcase_07 AC 6 ms
11,292 KB
testcase_08 AC 4 ms
8,880 KB
testcase_09 AC 6 ms
11,372 KB
testcase_10 AC 4 ms
9,532 KB
testcase_11 AC 3 ms
8,720 KB
testcase_12 AC 6 ms
11,424 KB
testcase_13 AC 3 ms
8,128 KB
testcase_14 AC 3 ms
7,988 KB
testcase_15 AC 4 ms
9,720 KB
testcase_16 AC 4 ms
9,080 KB
testcase_17 AC 5 ms
9,436 KB
testcase_18 AC 4 ms
9,108 KB
testcase_19 AC 5 ms
10,876 KB
testcase_20 AC 3 ms
7,992 KB
testcase_21 AC 3 ms
8,176 KB
testcase_22 AC 3 ms
7,624 KB
testcase_23 AC 2 ms
7,704 KB
testcase_24 AC 3 ms
7,700 KB
testcase_25 AC 3 ms
7,628 KB
testcase_26 AC 4 ms
9,760 KB
testcase_27 AC 5 ms
10,832 KB
testcase_28 AC 5 ms
9,844 KB
testcase_29 AC 5 ms
10,588 KB
testcase_30 AC 5 ms
10,788 KB
testcase_31 AC 2 ms
7,672 KB
testcase_32 AC 3 ms
7,668 KB
testcase_33 AC 6 ms
11,728 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 qualified Data.IntMap.Strict as M
import Data.List

main = getContents >>= print . sushi . map read . tail . words

sushi = fst . M.findMax . foldl dp (M.singleton 0 True)

dp im v = M.insertWith (||) (fst (M.findMax im)) True im'
 where im' = M.map (const False) $ M.mapKeys (+v) (M.filter id im)
0