結果

問題 No.4 おもりと天秤
ユーザー fmhrfmhr
提出日時 2015-04-22 16:30:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 266 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,516 KB
実行使用メモリ 7,888 KB
最終ジャッジ日時 2023-09-18 08:14:18
合計ジャッジ時間 3,820 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
7,780 KB
testcase_01 AC 28 ms
7,804 KB
testcase_02 AC 39 ms
7,748 KB
testcase_03 AC 35 ms
7,744 KB
testcase_04 AC 47 ms
7,800 KB
testcase_05 AC 261 ms
7,788 KB
testcase_06 AC 19 ms
7,860 KB
testcase_07 AC 219 ms
7,760 KB
testcase_08 AC 227 ms
7,784 KB
testcase_09 AC 114 ms
7,764 KB
testcase_10 AC 239 ms
7,848 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 19 ms
7,832 KB
testcase_14 WA -
testcase_15 AC 19 ms
7,844 KB
testcase_16 AC 31 ms
7,852 KB
testcase_17 AC 28 ms
7,756 KB
testcase_18 AC 167 ms
7,888 KB
testcase_19 AC 235 ms
7,772 KB
testcase_20 AC 227 ms
7,764 KB
testcase_21 AC 218 ms
7,808 KB
testcase_22 AC 259 ms
7,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
W = list(map(int, input().split()))

dp = [0] * 11000
dp[0] = 1
sum = sum(W)
for i in range(N):
    for j in range(10000):
        if dp[j]:
            dp[j+W[i]] = 1
if sum%2 == 0 and dp[sum//2]:
    print('possible')
else:
    print('impossible')
0