結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー tsukimizake774tsukimizake774
提出日時 2015-05-03 11:25:45
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 570 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 160,632 KB
実行使用メモリ 24,024 KB
最終ジャッジ日時 2023-09-19 05:11:54
合計ジャッジ時間 9,123 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
24,024 KB
testcase_01 AC 3 ms
7,136 KB
testcase_02 AC 312 ms
11,744 KB
testcase_03 AC 32 ms
9,604 KB
testcase_04 AC 3 ms
7,248 KB
testcase_05 AC 1,183 ms
12,072 KB
testcase_06 AC 3 ms
7,280 KB
testcase_07 TLE -
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

ソースコード

diff #

module Main where
import qualified Data.Set as S
import Data.List
import Data.Bits

solve :: [Int] -> Int
solve xs = length numlist
  where 
        onswitches = sublists $ xs
        numlist = nub  $ map getNumFromSwitches $ onswitches

getNumFromSwitches :: [Int] -> Int
getNumFromSwitches = foldr xor 0

sublists :: [Int] -> [[Int]]
sublists []  = [[]]
sublists (x:xs) = sublists xs ++ map (x:) (sublists xs)

          
main :: IO()
main = do _ <- getLine
          l <- getLine
          let xs = map read $ words l
          print $ solve xs
          
          
0