結果

問題 No.4 おもりと天秤
ユーザー taktak
提出日時 2018-04-12 19:49:09
言語 F#
(F# 4.0)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 433 bytes
コンパイル時間 3,145 ms
コンパイル使用メモリ 160,324 KB
実行使用メモリ 24,780 KB
最終ジャッジ日時 2023-09-09 04:25:55
合計ジャッジ時間 6,119 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
22,812 KB
testcase_01 AC 79 ms
22,676 KB
testcase_02 AC 81 ms
24,728 KB
testcase_03 AC 80 ms
24,692 KB
testcase_04 AC 80 ms
20,612 KB
testcase_05 AC 83 ms
22,744 KB
testcase_06 AC 79 ms
22,680 KB
testcase_07 AC 84 ms
24,744 KB
testcase_08 AC 83 ms
24,780 KB
testcase_09 AC 83 ms
24,704 KB
testcase_10 AC 84 ms
24,728 KB
testcase_11 AC 80 ms
22,744 KB
testcase_12 AC 80 ms
24,752 KB
testcase_13 AC 79 ms
22,696 KB
testcase_14 AC 80 ms
22,648 KB
testcase_15 AC 78 ms
20,732 KB
testcase_16 AC 81 ms
24,744 KB
testcase_17 AC 80 ms
22,708 KB
testcase_18 AC 82 ms
24,716 KB
testcase_19 AC 83 ms
22,612 KB
testcase_20 AC 82 ms
22,644 KB
testcase_21 AC 83 ms
22,672 KB
testcase_22 AC 85 ms
24,740 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let size = 100*100+5
let N    = stdin.ReadLine() |> int
let W    = stdin.ReadLine().Split() |> Array.map(int)
let sum  = W |> Array.sum

let dp = Array.zeroCreate size
dp.[0] <- true    
W   |> Array.iter (fun x ->
        for i in size-1 .. (-1) .. 0 do
            if dp.[i] then
                dp.[i+x] <- true)                            
if dp.[sum/2] && sum%2 = 0 then 
    "possible"
else
    "impossible"
|> printfn "%s"    
0