結果

問題 No.4 おもりと天秤
ユーザー Hirotaka OhkuboHirotaka Ohkubo
提出日時 2016-07-27 19:15:53
言語 Haskell
(9.6.2)
結果
MLE  
実行時間 -
コード長 302 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 167,136 KB
実行使用メモリ 816,360 KB
最終ジャッジ日時 2023-08-06 14:55:10
合計ジャッジ時間 8,000 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,148 KB
testcase_01 AC 2 ms
7,052 KB
testcase_02 AC 12 ms
11,816 KB
testcase_03 AC 3 ms
7,440 KB
testcase_04 AC 3 ms
7,524 KB
testcase_05 MLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Data.List

main = do
  getLine
  l <- getLine
  let ws = map read $ words l
  let r = compute ws
  putStrLn $ if r then "possible" else "impossible"

compute ws = even total && elem (div total 2) (make ws) where
  total = sum ws

make [] = [0]
make (x:xs) = ws ++ map (x+) ws where ws = make xs
0