結果

問題 No.4 おもりと天秤
ユーザー tookunn_1213tookunn_1213
提出日時 2015-08-18 00:14:56
言語 Python2
(2.7.18)
結果
AC  
実行時間 111 ms / 5,000 ms
コード長 282 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 6,672 KB
実行使用メモリ 6,436 KB
最終ジャッジ日時 2023-09-08 16:23:27
合計ジャッジ時間 2,654 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
6,436 KB
testcase_01 AC 15 ms
6,384 KB
testcase_02 AC 23 ms
6,332 KB
testcase_03 AC 19 ms
6,236 KB
testcase_04 AC 23 ms
6,256 KB
testcase_05 AC 108 ms
6,360 KB
testcase_06 AC 13 ms
6,308 KB
testcase_07 AC 109 ms
6,348 KB
testcase_08 AC 85 ms
6,228 KB
testcase_09 AC 85 ms
6,356 KB
testcase_10 AC 111 ms
6,356 KB
testcase_11 AC 17 ms
6,312 KB
testcase_12 AC 13 ms
6,232 KB
testcase_13 AC 14 ms
6,312 KB
testcase_14 AC 15 ms
6,332 KB
testcase_15 AC 13 ms
6,328 KB
testcase_16 AC 17 ms
6,256 KB
testcase_17 AC 16 ms
6,304 KB
testcase_18 AC 96 ms
6,356 KB
testcase_19 AC 106 ms
6,296 KB
testcase_20 AC 105 ms
6,268 KB
testcase_21 AC 104 ms
6,268 KB
testcase_22 AC 105 ms
6,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
W = map(int,raw_input().split())
wSum = sum(W)
dp = [0 for i in range(10100 + 1)]
dp[0] = 1
for i in range(N):
	for j in range(10000,-1,-1):
		if dp[j] == 1:
			dp[j + W[i]] = 1
if wSum % 2 == 0 and dp[wSum / 2] == 1:
	print 'possible'
else:
	print 'impossible'
0