結果
問題 | No.4 おもりと天秤 |
ユーザー | myuon |
提出日時 | 2015-03-09 08:08:11 |
言語 | Haskell (9.8.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 426 bytes |
コンパイル時間 | 864 ms |
コンパイル使用メモリ | 168,688 KB |
実行使用メモリ | 15,152 KB |
最終ジャッジ日時 | 2023-09-06 22:33:47 |
合計ジャッジ時間 | 7,772 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,932 KB |
testcase_01 | AC | 3 ms
6,968 KB |
testcase_02 | AC | 5 ms
7,516 KB |
testcase_03 | AC | 3 ms
7,096 KB |
testcase_04 | AC | 3 ms
7,300 KB |
testcase_05 | AC | 4 ms
7,524 KB |
testcase_06 | AC | 3 ms
7,060 KB |
testcase_07 | AC | 4 ms
7,500 KB |
testcase_08 | TLE | - |
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
ソースコード
import Control.Applicative import Data.List solve :: [Int] -> Bool solve (w:ws) = iter [w] [] ws where iter a b [] = sum a == sum b iter a b y@(x:xs) | sum a + sum y < sum b || sum a > sum y + sum b = False | otherwise = iter (x:a) b xs || iter a (x:b) xs main = do _ <- getLine ws <- fmap (read :: String -> Int) . words <$> getLine let a = solve $ ws putStrLn $ if a then "possible" else "impossible"