結果

問題 No.4 おもりと天秤
コンテスト
ユーザー daleksprinter
提出日時 2018-09-02 00:52:59
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 328 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 129 ms
コンパイル使用メモリ 77,756 KB
最終ジャッジ日時 2025-12-04 01:22:01
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())

arr = map(int,raw_input().split())

accumlate = sum(arr)
if accumlate %2 == 1:
	print 'impossible'
	quit()

dp = [0 for i in range(accumlate/2 + 1)]
dp[0] = 1

for i in arr:
	for j in range(accumlate/2+1):
		if j - i > -1 and dp[j-i] == 1:
			dp[j] = 1

print 'possible' if dp[accumlate/2] else 'impossible'


0