結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー | Eliza_0x |
提出日時 | 2018-05-13 14:44:26 |
言語 | Haskell (9.8.2) |
結果 |
MLE
|
実行時間 | - |
コード長 | 594 bytes |
コンパイル時間 | 2,594 ms |
コンパイル使用メモリ | 163,748 KB |
実行使用メモリ | 807,088 KB |
最終ジャッジ日時 | 2023-09-10 18:49:38 |
合計ジャッジ時間 | 5,833 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 22 ms
15,584 KB |
testcase_01 | AC | 32 ms
23,848 KB |
testcase_02 | AC | 114 ms
38,388 KB |
testcase_03 | AC | 94 ms
34,132 KB |
testcase_04 | AC | 23 ms
15,944 KB |
testcase_05 | AC | 113 ms
38,616 KB |
testcase_06 | AC | 73 ms
34,068 KB |
testcase_07 | MLE | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
コンパイルメッセージ
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.Bits import Data.Array main = do n <- read <$> getLine :: IO Int ns <- listArray (1,n) . map read . words <$> getLine :: IO (Array Int Int) let memo = dp ns 0 n (listArray (0,1) []) print . sum $ [if memo!i then 1 else 0 | i<-[0..r]] r = 33000 dp :: Array Int Int -> Int -> Int -> Array Int Bool -> Array Int Bool dp ns y n memo = if y > n then memo else dp ns (y+1) n memo' where memo' = array (0,r) $ [(x, f y x)|x<-[0..r]] f 0 0 = True f 0 _ = False f y x = memo!x || (if x `xor` ns!y < r then memo!(x `xor` (ns!y)) else False)