結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
Eliza_0x
|
| 提出日時 | 2018-05-13 14:22:22 |
| 言語 | Haskell (9.10.1) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 509 bytes |
| コンパイル時間 | 6,005 ms |
| コンパイル使用メモリ | 172,928 KB |
| 実行使用メモリ | 813,664 KB |
| 最終ジャッジ日時 | 2024-06-28 09:59:59 |
| 合計ジャッジ時間 | 9,607 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 MLE * 1 -- * 12 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/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)
print $ dp ns
dp :: Array Int Int -> Int
dp ns = sum [if memo!(n,i) then 1 else 0|i<-[0..r]]
where
r = 16384
(_,n) = bounds ns
memo = array ((0,0), (n, r)) $ [((y,x), f y x)|y<-[0..n], x<-[0..r]]
f 0 0 = True
f 0 _ = False
f y x = memo!(y-1, x) || (if x `xor` ns!y < r then memo!(y-1, x `xor` (ns!y)) else False)
Eliza_0x