結果

問題 No.4 おもりと天秤
ユーザー nbisconbisco
提出日時 2016-04-10 08:49:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-14 23:42:32
合計ジャッジ時間 4,493 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
10,880 KB
testcase_01 AC 47 ms
10,752 KB
testcase_02 AC 60 ms
10,880 KB
testcase_03 AC 57 ms
10,752 KB
testcase_04 AC 72 ms
10,752 KB
testcase_05 AC 330 ms
10,752 KB
testcase_06 AC 34 ms
10,752 KB
testcase_07 AC 334 ms
10,752 KB
testcase_08 AC 325 ms
10,752 KB
testcase_09 AC 140 ms
10,752 KB
testcase_10 AC 338 ms
10,752 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 34 ms
10,880 KB
testcase_14 WA -
testcase_15 AC 33 ms
10,752 KB
testcase_16 AC 54 ms
10,880 KB
testcase_17 AC 46 ms
10,752 KB
testcase_18 AC 226 ms
10,752 KB
testcase_19 AC 331 ms
10,752 KB
testcase_20 AC 338 ms
10,752 KB
testcase_21 AC 320 ms
10,752 KB
testcase_22 AC 329 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#fileencoding: utf-8

N = int(input().strip())
max_weight = 100*100
weight = [False] * (max_weight+1)
weight[0] = True
total = 0
for i in input().strip().split(" "):
    w = int(i)
    total += w
    for j in range(max_weight):
        if weight[j] and (j+w <= max_weight):
            weight[j+w] = True

print("possible" if (total%2 == 0 and weight[total//2]) else "impossible")
0