結果
問題 | No.949 飲酒プログラミングコンテスト |
ユーザー | Leonardone |
提出日時 | 2019-12-12 23:51:30 |
言語 | Haskell (9.8.2) |
結果 |
RE
|
実行時間 | - |
コード長 | 827 bytes |
コンパイル時間 | 991 ms |
コンパイル使用メモリ | 158,860 KB |
実行使用メモリ | 817,852 KB |
最終ジャッジ日時 | 2023-09-08 06:26:42 |
合計ジャッジ時間 | 6,560 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,584 KB |
testcase_01 | AC | 3 ms
7,588 KB |
testcase_02 | RE | - |
testcase_03 | AC | 3 ms
7,656 KB |
testcase_04 | AC | 4 ms
8,288 KB |
testcase_05 | AC | 5 ms
10,612 KB |
testcase_06 | AC | 5 ms
9,848 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | RE | - |
testcase_11 | MLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
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 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
コンパイルメッセージ
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
ソースコード
import Data.List (sort) import qualified Data.IntMap as M import Data.Maybe (fromJust) main = interact $ show . solve . map (map read . words) . lines solve ([n]:xs:ys:zs:_) = ans where n1 = n + 1 zzs = sort zs es = foldl f M.empty $ zip [0..n] xs f m ix = foldl (g ix) m $ zip [0..n] ys g (i,x) m (j,y) | i + j > n = m | otherwise = M.insertWith (++) (i+j) [(x+y,i*n1+j,(i-1)*n1+j,i*n1+j-1)] m ans = fst . fromJust . M.lookup 0 $ M.foldr h M.empty es h vs m = foldl u m vs u m (r,k,k1,k2) = ret where ff aa@(a,_) bb@(b,_) = if a > b then aa else bb ret = case M.findWithDefault (0, zzs) k m of (c, z:zs) | z <= r -> M.insertWith ff k2 (c+1,zs) $ M.insertWith ff k1 (c+1,zs) m _ -> m