結果

問題 No.4 おもりと天秤
ユーザー Snark86
提出日時 2016-04-25 02:02:50
言語 Python2
(2.7.18)
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 231 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2024-06-26 09:29:28
合計ジャッジ時間 1,669 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(raw_input())
W = map(int, raw_input().split())

a = [0 for _ in range(sum(W)+1)]
a[0] = 1
for i in W:
	for j in range(sum(W))[::-1]:
		if a[j]:
			a[i+j] = 1
print "possible" if sum(W)%2==0 and a[sum(W)/2] else "impossible"
0