結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー LeonardoneLeonardone
提出日時 2019-12-12 03:13:39
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 686 bytes
コンパイル時間 9,483 ms
コンパイル使用メモリ 163,596 KB
実行使用メモリ 12,020 KB
最終ジャッジ日時 2023-09-06 13:43:19
合計ジャッジ時間 14,624 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,804 KB
testcase_01 AC 3 ms
7,692 KB
testcase_02 AC 3 ms
7,696 KB
testcase_03 AC 3 ms
7,932 KB
testcase_04 AC 1,001 ms
12,020 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
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

ソースコード

diff #

-- Practice yukicoder 
-- author: Leonardone @ NEETSDKASU

import qualified Data.Set as S

main = interact $ show . solve . map (map read . words) . lines

solve ([n]:xs:ys:zs:_) = g 0 xs ys z
    where
        z = S.fromList $ zip zs [0..]
        g c xs ys s = f c (tail xs) ys s `max` f c xs (tail ys) s 
        f c _ _ s | S.null s || c == n = c
        f c [] _ _ = c
        f c _ [] _ = c
        f c xs@(x:_) ys@(y:_) s = g d xs ys t
            where
                r = x + y
                ss = fst $ S.split (r, n) s
                (t, d) = case S.maxView ss of
                    Just ((e, _), u) | e <= r -> (u, c + 1)
                    _ -> (ss, c)
                
0