結果

問題 No.4 おもりと天秤
ユーザー aimyaimy
提出日時 2017-04-22 12:09:22
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 400 bytes
コンパイル時間 3,718 ms
コンパイル使用メモリ 166,056 KB
実行使用メモリ 170,436 KB
最終ジャッジ日時 2023-09-28 21:16:10
合計ジャッジ時間 10,834 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
11,772 KB
testcase_01 AC 3 ms
7,252 KB
testcase_02 AC 2 ms
7,344 KB
testcase_03 AC 3 ms
7,248 KB
testcase_04 AC 3 ms
7,320 KB
testcase_05 AC 3 ms
7,712 KB
testcase_06 AC 3 ms
7,252 KB
testcase_07 AC 3 ms
7,672 KB
testcase_08 AC 3 ms
7,544 KB
testcase_09 AC 3 ms
7,748 KB
testcase_10 AC 3 ms
7,720 KB
testcase_11 AC 3 ms
7,472 KB
testcase_12 AC 3 ms
7,364 KB
testcase_13 AC 3 ms
7,288 KB
testcase_14 AC 3 ms
7,340 KB
testcase_15 AC 3 ms
7,364 KB
testcase_16 AC 3 ms
7,276 KB
testcase_17 AC 3 ms
7,292 KB
testcase_18 TLE -
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
import Data.Bool

main = getContents >>= putStrLn . bool "impossible" "possible" . dave . reverse . sort . map read . tail . words

dave :: [Int] -> Bool
dave ws = if odd (sum ws) then False else dave 0 0 ws
 where
  maxw = div (sum ws) 2
  dave l r [] = if l==r then True else False
  dave l r (w:ws)
   | l>maxw || r>maxw = False
   | otherwise = dave (l+w) r ws || dave l (r+w) ws
0