結果

問題 No.505 カードの数式2
ユーザー aimyaimy
提出日時 2017-04-22 00:09:55
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 2,829 ms
コンパイル使用メモリ 167,096 KB
実行使用メモリ 195,236 KB
最終ジャッジ日時 2023-09-28 11:29:28
合計ジャッジ時間 15,223 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,640 KB
testcase_01 AC 3 ms
8,236 KB
testcase_02 AC 32 ms
13,620 KB
testcase_03 AC 3 ms
7,344 KB
testcase_04 AC 2 ms
7,368 KB
testcase_05 AC 3 ms
7,452 KB
testcase_06 AC 2 ms
7,484 KB
testcase_07 WA -
testcase_08 AC 3 ms
7,404 KB
testcase_09 WA -
testcase_10 AC 2 ms
7,520 KB
testcase_11 AC 2 ms
7,480 KB
testcase_12 AC 2 ms
7,544 KB
testcase_13 WA -
testcase_14 AC 2 ms
7,556 KB
testcase_15 AC 2 ms
7,536 KB
testcase_16 WA -
testcase_17 AC 2 ms
7,560 KB
testcase_18 AC 2 ms
7,440 KB
testcase_19 WA -
testcase_20 AC 2 ms
7,580 KB
testcase_21 WA -
testcase_22 TLE -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1,462 ms
126,592 KB
testcase_27 AC 1,622 ms
151,172 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

import qualified Data.Set as S

main = getLine >> getLine >>= print . cardf . map read . words

cardf :: [Int] -> Int
cardf (n:ns) = cardf' (S.singleton n) ns
 where
  cardf' s [] = S.findMax s
  cardf' s (0:ns) = cardf' (S.fromList (concatMap (sequence [(+n),(+(negate n)),(*n)]) (S.toList s))) ns
  cardf' s (n:ns) = cardf' (S.fromList (concatMap (sequence [(+n),(+(negate n)),(*n),(`quot` n)]) (S.toList s))) ns
0