結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー nisizawanisizawa
提出日時 2018-07-21 20:57:18
言語 Haskell
(9.8.2)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 620 bytes
コンパイル時間 4,763 ms
コンパイル使用メモリ 164,984 KB
実行使用メモリ 20,076 KB
最終ジャッジ日時 2023-08-27 00:45:57
合計ジャッジ時間 3,953 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
11,332 KB
testcase_01 AC 132 ms
19,840 KB
testcase_02 AC 2 ms
6,988 KB
testcase_03 AC 3 ms
7,100 KB
testcase_04 AC 3 ms
7,012 KB
testcase_05 AC 122 ms
20,076 KB
testcase_06 AC 3 ms
7,084 KB
testcase_07 AC 2 ms
7,028 KB
testcase_08 AC 3 ms
7,064 KB
testcase_09 AC 3 ms
6,984 KB
testcase_10 AC 3 ms
6,964 KB
testcase_11 AC 3 ms
7,032 KB
testcase_12 AC 3 ms
6,956 KB
testcase_13 AC 2 ms
6,956 KB
testcase_14 AC 83 ms
16,788 KB
testcase_15 AC 42 ms
13,420 KB
testcase_16 AC 102 ms
17,916 KB
testcase_17 AC 32 ms
13,200 KB
testcase_18 AC 92 ms
17,180 KB
testcase_19 AC 72 ms
16,720 KB
testcase_20 AC 122 ms
19,896 KB
testcase_21 AC 12 ms
11,160 KB
testcase_22 AC 52 ms
14,472 KB
testcase_23 AC 122 ms
19,248 KB
testcase_24 AC 123 ms
20,068 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.Array.Unboxed

main :: IO ()
main = do
    n <- readLn :: IO Int
    ls <- return . map read . words =<< getLine :: IO [Int]
    let ans = solve ls
    print ans

solve :: [Int] -> Int
solve ls = solve_rec ls (listArray (1, 6) (repeat 0))
    where
        solve_rec :: [Int] -> UArray Int Int -> Int
        solve_rec [] arr = ans
            where
                ans = get_max_i arr 2 1
                get_max_i arr 7 max_i = max_i
                get_max_i arr i max_i = get_max_i arr (i + 1) (if arr!i >= arr!max_i then i else max_i)
        solve_rec (l:ls) arr = solve_rec ls (arr//[(l, arr!l + 1)])
0