結果

問題 No.4 おもりと天秤
ユーザー tookunn_1213
提出日時 2015-08-18 00:14:56
言語 Python2
(2.7.18)
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 282 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 09:16:37
合計ジャッジ時間 2,200 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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