結果

問題 No.4 おもりと天秤
ユーザー Hirotaka OhkuboHirotaka Ohkubo
提出日時 2016-07-27 19:15:53
言語 Haskell
(9.8.2)
結果
MLE  
実行時間 -
コード長 302 bytes
コンパイル時間 6,773 ms
コンパイル使用メモリ 175,616 KB
実行使用メモリ 817,024 KB
最終ジャッジ日時 2024-04-24 10:24:38
合計ジャッジ時間 6,399 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 5 ms
8,448 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 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.8.2/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