結果

問題 No.4 おもりと天秤
ユーザー AAAR SalmonAAAR Salmon
提出日時 2021-01-18 23:20:41
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 239 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 10,480 KB
実行使用メモリ 7,908 KB
最終ジャッジ日時 2023-08-21 06:47:05
合計ジャッジ時間 3,389 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,752 KB
testcase_01 AC 20 ms
7,804 KB
testcase_02 AC 29 ms
7,760 KB
testcase_03 AC 24 ms
7,752 KB
testcase_04 AC 29 ms
7,880 KB
testcase_05 AC 126 ms
7,692 KB
testcase_06 AC 17 ms
7,736 KB
testcase_07 AC 132 ms
7,760 KB
testcase_08 AC 104 ms
7,732 KB
testcase_09 AC 104 ms
7,776 KB
testcase_10 AC 134 ms
7,752 KB
testcase_11 AC 22 ms
7,752 KB
testcase_12 AC 19 ms
7,808 KB
testcase_13 AC 18 ms
7,720 KB
testcase_14 AC 19 ms
7,728 KB
testcase_15 AC 18 ms
7,844 KB
testcase_16 AC 22 ms
7,748 KB
testcase_17 AC 22 ms
7,756 KB
testcase_18 AC 116 ms
7,908 KB
testcase_19 AC 126 ms
7,740 KB
testcase_20 AC 129 ms
7,880 KB
testcase_21 AC 124 ms
7,740 KB
testcase_22 AC 124 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [False] * 10001
dp[0] = 1
sum = 0
for w in W:
	sum += w
	for i in range(10000, -1, -1):
		if dp[i]:
			dp[i+w] = True
print('possible' if sum % 2 == 0 and dp[sum // 2] else 'impossible')
0