結果
問題 | No.184 たのしい排他的論理和(HARD) |
ユーザー | e_gracilis |
提出日時 | 2015-06-17 16:20:03 |
言語 | Haskell (9.8.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 954 bytes |
コンパイル時間 | 845 ms |
コンパイル使用メモリ | 164,768 KB |
実行使用メモリ | 24,996 KB |
最終ジャッジ日時 | 2023-09-17 17:10:11 |
合計ジャッジ時間 | 7,479 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
7,124 KB |
testcase_01 | AC | 3 ms
7,168 KB |
testcase_02 | AC | 3 ms
7,140 KB |
testcase_03 | AC | 2 ms
7,104 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | RE | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 3 ms
7,288 KB |
testcase_19 | AC | 2 ms
7,028 KB |
testcase_20 | AC | 33 ms
16,680 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 3 ms
7,276 KB |
testcase_24 | RE | - |
testcase_25 | AC | 2 ms
7,296 KB |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
コンパイルメッセージ
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 qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B import Control.Applicative import Data.Maybe(fromJust) import Data.List import Debug.Trace default (Int) getInt :: IO Int getInt = fst . fromJust . B.readInt <$> B.getLine getInts :: IO [Int] getInts = map (fst . fromJust . B.readInt) <$> B.words <$> B.getLine main :: IO () main = do _n <- getInt as <- getInts print $ solve $ sortBy (flip compare) as solve :: [Int] -> Int solve xs = (2^) $ length $ filter (/=0) $ sweep xs (1 `shiftL` 60) sweep :: [Int] -> Int -> [Int] sweep as 0 = as sweep as@(x:_) b | x .&. b == 0 = sweep as (b `shiftR` 1) | otherwise = case sweep' as b of [] -> [] p:ps -> p:sweep ps (b `shiftR` 1) sweep' :: [Int] -> Int -> [Int] sweep' [] _ = [] sweep' xs@(a:as) b | (a .&. b) == 0 = xs | otherwise = a:map f as where f e = if e .&. b /= 0 then e `xor` a else e