結果

問題 No.29 パワーアップ
ユーザー highdhighd
提出日時 2016-08-20 20:16:41
言語 Haskell
(9.8.2)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 750 bytes
コンパイル時間 7,705 ms
コンパイル使用メモリ 171,636 KB
実行使用メモリ 8,848 KB
最終ジャッジ日時 2023-08-07 17:19:07
合計ジャッジ時間 2,380 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,820 KB
testcase_01 AC 2 ms
7,612 KB
testcase_02 AC 3 ms
7,772 KB
testcase_03 AC 3 ms
7,896 KB
testcase_04 AC 2 ms
7,796 KB
testcase_05 AC 3 ms
8,632 KB
testcase_06 AC 3 ms
8,396 KB
testcase_07 AC 3 ms
8,092 KB
testcase_08 AC 2 ms
7,896 KB
testcase_09 AC 3 ms
7,792 KB
testcase_10 AC 3 ms
8,848 KB
testcase_11 AC 3 ms
8,792 KB
testcase_12 AC 3 ms
7,876 KB
testcase_13 AC 3 ms
8,364 KB
testcase_14 AC 4 ms
8,632 KB
testcase_15 AC 3 ms
8,452 KB
testcase_16 AC 3 ms
8,336 KB
testcase_17 AC 3 ms
7,928 KB
testcase_18 AC 3 ms
8,232 KB
testcase_19 AC 3 ms
8,160 KB
testcase_20 AC 3 ms
7,776 KB
testcase_21 AC 3 ms
7,816 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 )

Main.hs:21:1: warning: [GHC-94817] [-Wtabs]
    Tab character found here, and in four further locations.
    Suggested fix: Please use spaces instead.
   |
21 |         m <- readInt<$>getLine
   | ^^^^^^^^
[2 of 2] Linking a.out

ソースコード

diff #

import qualified Data.Text as T
import qualified Data.Text.IO as TI
import Control.Applicative hiding (empty)
import Data.List hiding (concat)
import Data.Map hiding (filter)
import Data.Foldable
import Data.Monoid
import Prelude hiding (concat)
readLines = sequence.flip replicate TI.getLine

readInt::String->Int
readInt=read

count_dict :: (Ord k, Num a) => [k] -> Map k a
count_dict [] = empty
count_dict (x:xs) = 
  let s = count_dict xs in
      insertWithKey (\k x y ->x+y)  x 1 s

main = do
	m <- readInt<$>getLine
	list <- elems.count_dict.concat<$>fmap (fmap (readInt.T.unpack).T.split(==' '))<$>readLines m
	let same=getSum$foldMap (\x->Sum$x`div`2) list
	let not_same=length$filter ((/=0).(`mod`2)) list
	putStrLn$show$not_same`div`4+same
0